Results 1 to 5 of 5
  1. #1
    tomcatvickers is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2017
    Posts
    3

    Trying to import a *.csv file in Read Only mode

    Good morning Access wizards, I've been working on developing a tool in Access to let people check some inventory levels and part of that involves importing a .csv file on open. Unfortunately there is a small chance that the file might be in use by another user, in which case it creates an error and won't import the data. Is there any way to access the file in a read only mode and pull the data out? I'm not making any changes or adjustments, just importing it into an already existing table. Thanks in advance for any assistance!

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    what about saving a copy of the file first as another name then importing that file?

  3. #3
    tomcatvickers is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2017
    Posts
    3
    So I considered that option, but I've seen a few potential issues... the file that I'm importing updates every day (hence the need to import it on open) so it would have to be copied over manually every morning, unless there's an easy VBA code to do that. Secondly, the tool has the potential to be used by about 20-30 people daily so I would rather not have the program trying to copy the file over every time any one of them opens it, so is there a way in VBA to have it check the last update date on the copied file and then if it does not equal today, make a copy and import but if it DOES equal today, don't make a copy of the original and only import the copy? (hopefully that string of thoughts makes sense)

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    To make a copy of the file use FileCopy in VBA. Give the copy a name that you can check, such as adding the date and/or time to it which you can then check each time before importing it - does the file exist? If yes then bypass the copy and import. Here is some code to do that: http://allenbrowne.com/func-11.html

  5. #5
    tomcatvickers is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2017
    Posts
    3
    Hey that is fantastic, thank you very much! I will work on that and get it figured out. Thank you again!

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

Similar Threads

  1. Replies: 3
    Last Post: 12-01-2014, 07:47 AM
  2. Open Access Database in Read Only Mode
    By praloy in forum Programming
    Replies: 2
    Last Post: 03-28-2012, 10:50 PM
  3. Replies: 7
    Last Post: 03-23-2012, 01:55 PM
  4. Replies: 2
    Last Post: 09-01-2011, 10:48 PM
  5. Replies: 7
    Last Post: 03-22-2011, 10:36 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