Solved

Easy way to check if a file exists in access vb

Posted on 2011-02-23
2
393 Views
Last Modified: 2013-11-28
Need a simple way to check if a file exists in access so if the file does not exist it bypasses the query. The code I attached works if you step through the code using F8, But if you run the code it blows through the err checks and trys to run the query. Any suggestions would be great.
Dir ("SurveyTbl")
If Err.Number = 3078 Then GoTo dorest



    Call ClearTbl("E2distinctSurveyDistrict")
    CurrentDb.Execute "E2SurveyTblQryAppend"
  


dorest:

Open in new window

0
Comment
Question by:needhelpfast569
2 Comments
 

Accepted Solution

by:
needhelpfast569 earned 0 total points
ID: 34962395
Found the answer.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 34962422
Dir () doesn't return an error if the file is not found.
It just returns ""
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question