I have a bitmap picture stored in an Attachment field (one picture in one Attachment field). - I would like to display this picture on a form bound to another table.
I have put an unbound Attachment control on this form.
I have tried to display the picture by running VBA code:
1. creating a DAO recordset, DAO.Recordset, and locating the record and field which stores the picture,
2. then creating another recordset, DAO.Recordset2:
Set DAO.Recordset2 = DAO.Recordset.Fields(“[name of the field which holds the picture]”).Value,
3. and then trying to display the picture:
[unbound attachment control].DefaultPicture = DAO.Recordset2.Fields(“FileName”).
Access generates an error message 2220: can’t open the file “name of the file”. (I am, therefore, locating the record and attachment field correctly - just need to get at the picture!)
Is there a way of displaying a picture stored in an Attachment field on a form NOT bound to the table containing the Attachment field?
Thank you very much for any help. - Storing pictures in Attachment fields seems such a good idea; surely there must be a way to retrieve them and to display them without binding the controls to the fields themselves.
I do hope there is an answer, thank you, Pavla.
I have put an unbound Attachment control on this form.
I have tried to display the picture by running VBA code:
1. creating a DAO recordset, DAO.Recordset, and locating the record and field which stores the picture,
2. then creating another recordset, DAO.Recordset2:
Set DAO.Recordset2 = DAO.Recordset.Fields(“[name of the field which holds the picture]”).Value,
3. and then trying to display the picture:
[unbound attachment control].DefaultPicture = DAO.Recordset2.Fields(“FileName”).
Access generates an error message 2220: can’t open the file “name of the file”. (I am, therefore, locating the record and attachment field correctly - just need to get at the picture!)
Is there a way of displaying a picture stored in an Attachment field on a form NOT bound to the table containing the Attachment field?
Thank you very much for any help. - Storing pictures in Attachment fields seems such a good idea; surely there must be a way to retrieve them and to display them without binding the controls to the fields themselves.
I do hope there is an answer, thank you, Pavla.