Solved

Easy way to check if a file exists in access vb

Posted on 2011-02-23
2
391 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dsum Function for List Box Data 7 45
unable to save new report from old one 9 29
VBA Access 2016 syntax 6 43
Access check if a table is open 4 42
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

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