Results 1 to 6 of 6
  1. #1
    HelpMeWithAccess is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Posts
    6

    Question Access: Attach to a folder

    - My access has attachment field.
    - I attached to a folder, containing jpeg files.


    - Well, I will add more jpeg files with different names later (not exact time) or no adding.
    - When I add jpeg files, I want my attachment field auto adopt the new jpeg files. (I don't wanna attach manually everytime I add a new jpeg files.)
    - Please help me anyone? ? ?
    - Thanks a lot! ! !

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I am not sure I understand your problem, but if you are trying to retrieve a list of JPG files within a specific folder I would NOT add them as an attachment in your database, I would store the file names as STRINGS (NOT OLE objects) then, when necessary, open them with the appropriate application. Basically, if you are storing a JPG as an object within your table you are doubling going to cause your database to blow up in size, and you will essentially have 2 copies of the picture, 1 in your database, 1 in your picture folder and the two will not necessarily agree.

    It would be easier to cycle through your folder (you can even do it recursively if necessary) and extract the file names/folders and store those values as strings in your database.

  3. #3
    HelpMeWithAccess is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Posts
    6
    Well, if you would store the file names as STRINGS, and so on, using the appropriate application, and so on. . . please tell me step by step instruction.
    I don't know how to do . . .
    Thanks,
    me

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Very basic way to cycle through files in a folder using FILESYSTEMOBJECT:

    http://blogs.technet.com/b/heyscript...ubfolders.aspx

    You can extract the file name, path (if you're not putting it in manually or using a dialog box to navigate to it), or really any file properties using filesystemobject commands.

    Then you can create a string based on the file path and name and append that value to your table.

  5. #5
    HelpMeWithAccess is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Posts
    6

    Thumbs up

    Dear rpeare,

    I tried with these code (which is I got from the site you mentioned) in On-Click Event of Attachment field on the form...
    "
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objStartFolder = "D:\PPPTesting\Colposcopy\ManyImg"

    Set objFolder = objFSO.GetFolder(objStartFolder)

    Set colFiles = objFolder.Files
    For Each objFile In colFiles
    Wscript.Echo objFile.Name
    Next
    "

    And when I click my Attachment in Form View,

    I have this problem...

    "Run-time error '424':

    Object required

    End| Debug| Help

    When I debug,

    Wscript.Echo objFile.Name // This line is highlighted


    objFile has problem, I think.

    If you don't mind,
    Tell me how to solve it...

    However, thank you for your help.

    With Regards,
    me

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    um... I think you are mixing up my message.

    Here's an example database I wrote for someone else that returns files in a specific folder and puts them in a list box.

    Instead of writing the file names to a list box you could write them to a table, along with the file path.

    That is *1* part of the process. That's the part I thought you were asking for, retrieving a list of files from a particular folder so you didn't have to manually type them in.

    Ace2014.zip

    Get the part where you are writing files to an access table first. Then work on the next part of your problem.

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

Similar Threads

  1. Replies: 4
    Last Post: 06-27-2013, 12:29 PM
  2. attach scanner to access
    By msasan1367 in forum Access
    Replies: 3
    Last Post: 03-14-2013, 10:52 AM
  3. How do you bulk attach files in Access?
    By newyorkyankee in forum Access
    Replies: 5
    Last Post: 05-11-2012, 01:06 PM
  4. open folder/Make new folder(example)-VBA Code
    By Madmax in forum Code Repository
    Replies: 3
    Last Post: 03-13-2012, 09:17 AM
  5. Replies: 0
    Last Post: 04-24-2009, 12:20 AM

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