473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Add Attachment to form

Catalyst159
111 100+
I have a linked table called "dbo_problems", and a form called "Problem Records Details". I have created a table called "Attachments". The "Attachments" table contains the following fields: ID, Problem_ID, and Attachment.

ID is Primary Key (DataType=AutoNumber)
Problem_ID is (DataType=Number) (Indexed Yes No Duplicates)
Attachment is (DataType=Attachment) (Required = No)

The form "Problem Records Details" has an Unbound object called Attachment. I would like the user to be able to insert an attachment from this form. I have tried the following as the control source:

Expand|Select|Wrap|Line Numbers
  1. SELECT [Attachment] FROM [Attachments] WHERE [Problem_ID]=Forms![Problem Records Details]![ID];
Only the attachments where Problem_ID of the attachments table equals the ID of the record displayed on the "Problem Records Details" form.

This does not seem to be working. Any help, ideas, or insight would be greatly appreciated.

Thank you in advance.

Regards,

Catalyst
Jan 18 '12 #1

✓ answered by Rabbit

Create a new form using the attachment tables. Save it. Go to the main form. Put a subform control on there. Point it to the form you just created.

12 8262
Rabbit
12,516 Expert Mod 8TB
If Problem_ID in the attachment table is unique, why did you put it in its own table? If it's going to be one to one anyways, just put it in the same table.
Jan 18 '12 #2
Catalyst159
111 100+
The dbo_problems table is a linked table. So I can not create a new Attachments field.

I want to keep all attachments in a different local table called Attachments. The Problem_ID field in the Attachments table should reference the ID field of the dbo_problems table. I am not sure if I explained it ok. I just realized however now that you made the comment that I would probably need to dump the ID field data from dbo_problems into the Attachments table, right ? Let me know if I am still confusing.
Jan 18 '12 #3
Rabbit
12,516 Expert Mod 8TB
It's not necessary to insert all the ids from the problem table. You could use an outer join query as the source for your form and see if that's updatable. If not, you'll just need to create a separate form that you can call when you want to attach a file.
Jan 18 '12 #4
Catalyst159
111 100+
What do you mean, see if that's updateable? And how would you go about using an outer join query? What would the outer join query look like ?
Jan 18 '12 #5
Rabbit
12,516 Expert Mod 8TB
When you use a join query, the fields are not always updatable. The only way to know for sure is to do it and see if you can update the fields you want. An outer join query looks like this
Expand|Select|Wrap|Line Numbers
  1. SELECT*
  2. FROM Table1
  3. LEFT JOIN Table2
  4. ON Table1.UniqueID = Table2.ForeignKey
Jan 18 '12 #6
Catalyst159
111 100+
So it would be like:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM dbo_problems LEFT JOIN Attachments ON dbo_problems.ID = Attachments.Problem_ID
Jan 18 '12 #7
Rabbit
12,516 Expert Mod 8TB
Yes, and if the attachment field is updatable, then you can just bind the control to that field. So you don't have to use code to try to update it.
Jan 18 '12 #8
Catalyst159
111 100+
When I right click on the paper clip in the form everything is greyed out. Manage Attachments is greyed out. Any Ideas?
Jan 18 '12 #9
Rabbit
12,516 Expert Mod 8TB
That means it's not updatable. What you'll need to do instead is create a separate form for the attachments and then include it on the main form as a subform.
Jan 18 '12 #10
Catalyst159
111 100+
I am not sure how to include a separate form for the attachments on the Main form as an attachment. Could you explain how to go about doing this?
Jan 18 '12 #11
Rabbit
12,516 Expert Mod 8TB
Create a new form using the attachment tables. Save it. Go to the main form. Put a subform control on there. Point it to the form you just created.
Jan 18 '12 #12
Catalyst159
111 100+
Ok. Let me give it a try.
Jan 18 '12 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Roy G. Vervoort | last post by:
With them help of newsgroups I created a form that makes it possible to sent an email with an attachement thats on the internet.. How can i attache a file thats on the users harddrive? this...
1
by: a c s | last post by:
Hi there, my problem is as follows: When emailing a file using PHP 4.0.6, the attachment received is an empty "attachment.txt" file instead of the actual file I attached. Any suggestions why...
1
by: abracad | last post by:
I'd like to add a form that will email a file attachment to me. Can anyone recommend a decent free script? Thanks
9
by: deepaks85 | last post by:
Dear Sir, I have created a simple request form which will be mailed to me. Now I want to attach files and send it through that request form. For this I am using the following script: ...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
0
by: canistel | last post by:
Hi, I have a little python webservice that I created, and in one of the methods I need to store some binary data that was "posted"... I want to do something like this, but it doesn't work. ...
57
by: bonneylake | last post by:
Hey Everyone, well was hoping if someone could explain to me how to add an alert for the description fields of this multiple attachments script. The problem i think i am having is i don't know how...
1
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the...
1
by: metalforever | last post by:
How do you redirect a form after submit(form sends email) ? This is pretty urgent for me. I have included the code in a pastebin. http://pastebin.org/249014 process_form sends the email. ...
4
by: luke noob | last post by:
This is my HTML... <head> <script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script> <script type="text/javascript" src="js/script.js"></script> </head> <body>
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.