Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

See if an external file exists from within Access 2

Status
Not open for further replies.

BanditLV

Programmer
Oct 17, 2000
50
US
I have the following line in my Module:

Call Shell("C:\WINDOWS\NOTEPAD.EXE c:\Progra~1\RPS\Create\Reject.fil", 1)

However, there will be instances where this Call line will not find the file of "Reject.fil" and will ask the user if they would like to create a new document... I would like to bypass this possibility...

What I would like to do from within my Module coding, is determine whether or not the "Reject.fil" exists and bypass from there... I believe this to be the simpler process than trying to answer the Notepad's question from within Access... Although, I'm always open to more efficient means and thoughts...

Roy aka BanditLV
Las Vegas
 
Try using the Dir function.

Dir returns the base file name if the file exists otherwise a zero length string. Combine the 2 of these functions and you'll have the branching capabilities you'll need.

if len(dir("c:\Progra~1\RPS\Create\Reject.fil")) > 0 then
...
endif

Hope this helps.

Scott.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top