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

Searching for a Table using code 1

Status
Not open for further replies.

SPL26

Technical User
Apr 26, 2004
14
US
Hi,

Can anybody help,

I'm trying to find a table in a database, and if this table does not exist, then I will create it.

The bit I'm having trouble with is how do I see if this table exists or not using code. I'm using Access 2000 by the way.

Regards
 
A crude way:
On Error Resume Next
t = CurrentDB.TableDefs("yourTable").Name
e = Err.Number
On Error GoTo 0
If e Then
Err.Clear
' create table stuff
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for that, works just fine !

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top