Results 1 to 2 of 2
  1. #1
    forestgump is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2011
    Posts
    8

    Find file

    I currently have code running that deletes down a table and imports in new data by entering the file name into a text box. However, if I accidently write the incorrect file name the query goes into debug mode because it cannot find the file.



    Is there any way the code can search for the file first and if it cannot find the file it returns a message "Cannot locate file" and does not try and run the rest of the code?

    Any help would be greatly appreciated.

    Kind regards,

    forest

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    If Dir("Your\Path\and\filename") <> vbNullString Then
    '... Your file exists
    Else
    '... Does not exist
    End If

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

Similar Threads

  1. "could not find file"
    By sarah54 in forum Access
    Replies: 14
    Last Post: 02-06-2011, 07:25 PM
  2. Replies: 1
    Last Post: 09-27-2010, 10:10 AM
  3. Command Button to Find .doc file
    By cg1465 in forum Forms
    Replies: 8
    Last Post: 09-15-2010, 08:28 AM
  4. Replies: 2
    Last Post: 03-02-2010, 12:02 PM
  5. Upload file inside .mdb database file
    By havish in forum Access
    Replies: 0
    Last Post: 07-30-2008, 07:35 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