Question : Save file from Attachment type data field

Is there a way in Access 2007 using vba to export or save the attachment files from a field that has field type "Attachment" to a hard drive location?  The file type is always jpg.

I have form where the user selects the record which contains the following fields...
item name
item description
price
category1
attachment  (jpg image)

I need to export the record information into a txt file (i dont need help with that part) and i need to save (ideally ftp the jpg image to the web server).  If i can at least save the image to a hard drive location, i can then run a script to upload it via ftp.  Hope this is enough info.

Answer : Save file from Attachment type data field

Here's a blog posting that shows how to get at the Attachment field:

http://blogs.msdn.com/access/archive/2007/08/30/using-vba-code-to-open-a-file-stored-in-the-new-access-2007-attachment-field.aspx

The important lines are below:

Note that you must have a valid DAO recordset (in this case, rstCurrent) in order to get to the Attachment field's data:
Set rstChild = rstCurrent.Fields(strFieldName).Value ' the .Value for a complex field returns the underlying recordset.

In the line below, fldAttach will actually contain the Data:
Set fldAttach = rstChild.Fields("FileData") ' The binary data of the file.
Random Solutions  
 
programming4us programming4us