Results 1 to 2 of 2
  1. #1
    akapag22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    20

    transfer files from one folder to another and save the fielpath in database?

    HI Friends,

    I am trying to create a form with command button which when clicked i would like to transfer photo files from folder x to folder y and save the new path in the database as a new record from each photo.



    The fields in the database PhotoTable are recordid (autonumber), filepath, Photoname. How can i get this done in the button click as VBA code. Thank You

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    There are many methods to move a file.
    You can copy and paste, then delete (kill statement) the file.
    You can use filecopy, then delete (kill statement) the file.

    You can use the File System Object. <<== what I did

    Rather than try and explain how to use the file system object, I created a demo dB. This WILL move files!! Be warned!!
    To test this dB, use junk files - files that you don't mind losing, until you are satisfied everything is proceding correctly.

    '************************************************* *
    ' NOTE: requires a reference to Microsoft Office xx.0 Object Library
    '--------------------------------------------------
    'To use this code, you must reference
    'The Microsoft Office 14.0 (or current version)
    'Object Library by clicking menu Tools>References
    'Check the box for:
    'Microsoft Office 14.0 Object Library in Access 2010
    'Microsoft Office 15.0 Object Library in Access 2013
    'Click OK
    '--------------------------------------------------
    '************************************************* *


    Wait! There's more!
    In addition to moving files, the code also inserts a record into the table. Move a few files then look at the table to see if it is what you want.

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

Similar Threads

  1. How to get name of files in a folder
    By behnam in forum Programming
    Replies: 1
    Last Post: 09-18-2014, 07:46 AM
  2. Moving ALL Files in a Folder
    By JoeM in forum Programming
    Replies: 4
    Last Post: 04-19-2013, 01:59 PM
  3. Transfer all text files in a specified folder
    By rtackett in forum Programming
    Replies: 4
    Last Post: 09-10-2012, 11:50 AM
  4. Transfer text files
    By raytackettsells in forum Import/Export Data
    Replies: 5
    Last Post: 09-08-2012, 12:37 PM
  5. Replies: 9
    Last Post: 05-30-2011, 12:08 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