Results 1 to 9 of 9
  1. #1
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61

    Need Help (prevent Overwriting Existing File, Access 2010


    Need Help in modifying code to prevent from overwriting existing file.

    The code copy's file correctly but does not prevent the user from overwriting existing code.

    I need help with this.

    Example Upload Button.zip

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You just need to add code to check if the file exists in the destination directory. Then decide if you want to overwrite the existing file.

    See:
    FileExists() and FolderExists() functions
    http://allenbrowne.com/func-11.html

  3. #3
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61
    Hi Steve,
    I am still pretty new with Access. I am not sure how to add this within the IF Then statement in the code.

    After Copy File, If file exist in destination folder then prompt user with message, file exist, rename file.

    I am not sure how to implement in code without breaking it.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    How about this??
    Attached Files Attached Files

  5. #5
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61
    Wow, thank you alot...That is a beast of a code. I will study it to see how it works, also I am trying
    to modify it to send the copied file to a designated destination folder.

    Thank you again Steve.

  6. #6
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61
    I have tried modifying it several times and still not able to paste it in another folder other than CurrentProject Path.

    Can you please help me again?

    Thank you.

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I added select the destination folder code. You select the destination, then select the file to copy.

    I also modified some if the code in "Command3_Click()"......
    Attached Files Attached Files

  8. #8
    Alphix is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    61
    Thank you Steve, this is what I needed.
    Take care.

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome...

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

Similar Threads

  1. Adding Existing Fields in MS Access 2010
    By Lou_Reed in forum Access
    Replies: 2
    Last Post: 09-25-2015, 12:24 PM
  2. Replies: 7
    Last Post: 06-05-2015, 11:13 AM
  3. Replies: 4
    Last Post: 11-21-2013, 12:33 PM
  4. Replies: 2
    Last Post: 02-29-2012, 12:51 AM
  5. Linking Workbook and Overwriting Excel File
    By Atheron in forum Import/Export Data
    Replies: 2
    Last Post: 10-08-2011, 03:44 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