473,473 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I display an Attachment from a table on a form?

33 New Member
I'v already done some research on database normalization but I can't find a solution to my specific problem.

I have a main table:

- Name: tblSteps
- Primary Key: StepID (Autonumber)
- StepName (Text)
- PartID1 (number)
- Qty1 (number)
- PartID2 (number)
- Qty2 (number)
- PartID3 (number)
- Qty3 (number)
- PartID4 (number)
- Qty4 (number)

And a secondary table:

- Name: tblParts
- Primary Key: PartID (Autonumber)
- PartNumber (number)
- PartDescription (text)
- PartPicture (attachment)

Also I have a form with:

- nameBox (textbox bounded to StepName field)
- qtyBox1 (textboxe bounded to qty1 field)
- qtyBox2 (textboxe bounded to qty2 field)
- qtyBox3 (textboxe bounded to qty3 field)
- qtyBox4 (textboxe bounded to qty4 field)
- cboPart1 (combobox with PartID, PartNumber and PartDescription as Rowsource, Controlsource = PartID1)
- cboPart2 (combobox with PartID, PartNumber and PartDescription as Rowsource, Controlsource = PartID2)
- cboPart3 (combobox with PartID, PartNumber and PartDescription as Rowsource, Controlsource = PartID3)
- cboPart4 (combobox with PartID, PartNumber and PartDescription as Rowsource, Controlsource = PartID4)
- Attachment1Box (attachmentfield)
- Attachment2Box (attachmentfield)
- Attachment3Box (attachmentfield)
- Attachment4Box (attachmentfield)

And there is also a button ("cmdCreate") to save all the values in the Controls to a new record in the tblSteps.


The user selects a part from the cboPart1 combobox which stores the selected value in the PartID1 field in tblSteps. When I press the "Create" button this value is stored to the record. But now I want to show the attachment (which is related to the PartID value selected in the combobox) in the Attachmentfield (Attachment1Box).

Is this actually possible with the Attachment Control Object?

Kind regards,

Jeroen.
Oct 22 '14 #1
5 20294
twinnyfo
3,653 Recognized Expert Moderator Specialist
As far as I know, you cannot display an attachment on a form. It is a nifty feature of later versions of Access, but their usefulness is limited.
Oct 22 '14 #2
Jeroen3131
33 New Member
I'm currently using Access 2010 and I've just noticed that in the sample database "Northwind", on the Supplier Details form, you can upload a picture to the attachment object and save it to the table which is bound to the form.

The problem with my situation is that my "tblParts" isn't bound to the form (because tblSteps is).
Oct 23 '14 #3
twinnyfo
3,653 Recognized Expert Moderator Specialist
Jeroen3131,

Yes, you can upload pictures to an attachment field, but they will not "display". That is one of the shortcomings of the Attachment field. They can hold any type of file you want, but they are just a container to hold the file, not a control to display.

If you want a photo to display, on a record-by-record basis, use an Image Control, with no image associated with it. Then, you have a Folder with all your images (it must be a public folder if this is a networked project). Your Table would then have not an Attachment Field, but a Text Field which simply holds the location and file name of the image. Then, during run time, in the OnCurrent Event of your Form, have the form assign the Location\FileName of the image to the Image Control:

Expand|Select|Wrap|Line Numbers
  1. Me.imgDemo.Picture = Me.txtImageFile
This method also saves HUGE amounts of resources, as MS Access' method of saving images internally is a massive memory hog.

Hope this hepps!
Oct 23 '14 #4
Jeroen3131
33 New Member
Thanks Twinnyfo.

Setting the Image Control works like a charm!

But now I realise my database design is wrong.

I've opened a new topic for it here:

http://bytes.com/topic/access/answer...el#post3782622
Oct 23 '14 #5
twinnyfo
3,653 Recognized Expert Moderator Specialist
I'm glad I could help with your image issue. I've taken a look at your other thread and will continue to assist as I am able.
Oct 23 '14 #6

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

Similar topics

3
by: Ken | last post by:
I have a database called autographs.mdb that is in the "XYZ" folder in the "database" folder. I have a form in the database that I want to display a photo of the celeb on. The photos are in a...
3
by: Raed Sawalha | last post by:
Dear : I have an image in a aspx page I need when user mouseover it to display HTML Table with links. Regards
1
by: bhavik | last post by:
hi I have problem with attachment showing form server side. when our application run on localhost we add any attachment to mail server. if suppose we want to show that attachment we can see...
1
by: abc my vclass | last post by:
Is VS2005 debugger let me to see dataset, datatable data as table form? I found if I watch some table or dataset variable is very very hard to see. Is there any good tools or add-ins for debugger...
1
by: Soumya v s | last post by:
i wants to display all table names in the combo box with php and mysql
3
by: saravanancse | last post by:
Can Any One Help Me....... How to display a Windows Form into Html page? I used Html Syntax <a href="that vb file name">file</a> But its shows only a coding,its doesn't show...
1
by: Maryanne | last post by:
1) How do I display in a form a string of 1:M relationships? (or does it need to resort to multiple forms?) * Starts with Client that has consultant and consultation desk. Client has many...
1
by: Larry Rebich | last post by:
Is there a way to display a web page then do something else - similar to the DoEvents in VB6? I have a rather long running process and I'd like to display the web form but during PageLoad I'd...
0
by: bhasins | last post by:
Hi All , I am facing a problem while accessing the attachment table of a message imported from MSG file in VB.NET . I am making use of Redemption library function GetItemFromMessageFile . My...
1
by: khadar siddi | last post by:
I have tested this in the following two browsers. 1.Internet Exolorer 2.Mozilla FireFox In Internet Explorer: ------------------------ When I right click and see the view source...the html...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.