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

Check if a table exists 1

Status
Not open for further replies.

dcusick

Technical User
Aug 9, 2000
271
US
I was wondering if someone could help me. I want to check to see if a table exists in my DB through VB code... Is there some function out there that could tell me this? Thanks in advance for the help.

Doug
 
i think it is something like this:

dim db as database
dim tb as tabledefs
dim bExists as boolean

set db = currentdb

for each tb in db.tabledefs

if TABLENAME = tb.name then
bExists = true
exit for
end if

next tb

I hope this code is not too inaccurate.

Nick
 
Very close... The only problem was that tb had to be defined as tabledef, not tabledefs. But besides that, the code worked just like what I needed. Thanks for the help. It's greatly appreciated.

Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top