Results 1 to 4 of 4
  1. #1
    morespamforya is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2010
    Posts
    1

    How do you file save an 'Attachment' content through code?

    Hi, I have a need to output a list of about 22000 entries, each one with a JPG attachment, into a directory (i.e. save every attachment of every entry back into a file)



    However, there doesn't seem to be any immediate ways to do this other than clicking on each entry, then clicking on its attachment, and then clicking "save as".

    It would seem sensible that there must be an code specific way to do it, seeing as that functionality is already coded in the attachment "Save As" button. Is there anyway to invoke that function automatically?

    Thank you

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    To get each file in a given directory, you could do something like this.

    Code:
    Dim strDir As String
    Dim strFileName As String
    Dim strPath As String
    strDir = ""
    strPath = "C:\YourDirectory\"
    strDir = Dir(strPath & "*.*", vbNormal)
    Do Until strDir = ""
        strFileName = strDir
        strDir = Dir
    Loop
    You could have some type of append query in the loop to trigger each time to add each file.

  3. #3
    DaveT is offline Access Developer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    May 2010
    Location
    Texas
    Posts
    69
    Might take a look at:
    Adding, removing, and saving files from the new Attachment field in Access 2007

    http://blogs.msdn.com/b/access/archi...cess-2007.aspx

  4. #4
    DaveT is offline Access Developer
    Windows 7 Access 2010 (version 14.0)
    Join Date
    May 2010
    Location
    Texas
    Posts
    69

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How would you output an XML file with an Ole Attachment?
    By techneophyte in forum Programming
    Replies: 7
    Last Post: 09-09-2010, 09:09 AM
  2. Help With Save Data Code
    By ColPat in forum Programming
    Replies: 5
    Last Post: 06-07-2010, 12:17 PM
  3. Replies: 0
    Last Post: 05-14-2010, 07:28 AM
  4. Access 2007 Code Guru please: Unbound Attachment
    By MatthewFF in forum Programming
    Replies: 2
    Last Post: 02-01-2010, 07:31 AM
  5. How To View Hyperlink For Attachment File
    By treyprice in forum Access
    Replies: 0
    Last Post: 07-28-2009, 12:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums