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

File import, warning table already exists. How?

Status
Not open for further replies.

NDK

MIS
Jan 4, 2006
8
US
Hello all,
Using VBA, I'm importing a .txt file into a table the name of which is derived from part of the .txt file name. I want to warn the user if a table of that name already exists.
How do I inspect the current database for an existing table of the same name?

Many thanks,
ND
 
bAlreadyExists=false
On Error goto Myline
(attempt to open it)
on error goto 0
if bAlreadyExists then
msgbox ...
exit sub
endif

Myline:
bAlreadyExists=true
 
You're welcome. Glad it worked out.

I appreciate your thanks, because I spend real time on some of these replies, and often - real often - never hear a peep - nada. A simple acknowledgement or later followup as to the outcome is always worthwhile. (Yours wasn't too bad, though, and I'm happy to help out).

It needs a Resume Next statement at the bottom of my prior post, too [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top