Solved

Easy way to check if a file exists in access vb

Posted on 2011-02-23
2
389 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
Comment Utility
Found the answer.
0
 
LVL 77

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now