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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Needed With Code Problem

Status
Not open for further replies.

Daz

Technical User
Nov 19, 2000
13
GB
Hi,

I use the following code on a click event on a customer record.

It looks in the C:\Outgoing Directory for a file, if the file is there it imports the record and then deletes the import file from C:\Outgoing.

The problem i have is, if there is no file in the C:\Outgoing Directory, then i get an error messege saying file not found.

Does anyone know to tell the program just to stop if there is no file available and not show the error message?

DoCmd.TransferText acImportDelim, "Import Specification All Data", "ImportAllData_Tbl", "C:\Outgoing\" & strName & ".txt"

Kill "C:\Outgoing\" & strName & ".txt"

Many Thanks

Darrell...

 
private sub YourSub()
on error goto errorhandler
'do your checking here
exit sub
errorhandler:
select case err.number
case 53
' file not found routine
end select
end sub



 
Or:
Code:
If Dir(&quot;C:\Outgoing\&quot; & strName & &quot;.txt&quot;) <> &quot;&quot;
     'Found the file - do your stuff
Else
     'No File
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top