I have a table items with two attributes: description (text) and picture (attachment field)
I want to make a form that contains a buttons for each item, items with picture are shown in the button's picture, otherwise their description is shown in the button's caption as follows:
I used the following code to do it
The form works fine directly after I add/modify the attachment fields in the table, but if I open the form without making any updates to the attachment fields, it shows the following error: can not open the file "Hamburger.bmp"Code:Dim rs As Recordset Set rs = CurrentDb.OpenRecordset("SELECT description,picture.FileName FROM Item") rs.MoveFirst Do Until counter = 7 Me.Controls("Item" & counter).Caption = rs![description] Me.Controls("Item" & counter).Picture = IIf(IsNull(rs![picture.FileName]), "", rs![picture.FileName]) counter = counter + 1 rs.MoveNext Loop rs.Close
Note that all the pictures in the attachment fields are embedded inside the table and I don't want to use any external folder to store pictures
Any idea why pictures are shown after updating them only? What should I do to make embedded picture attachments accessible after reopening the db without updating them?