|
-
September 19th, 2001, 05:50 AM
#1
checking database tables
how can i check to see if a database table exists?
is there a simple expression to handle this or do i need to figure out some way of looping through all the tables in the database and checking them one by one?
-
September 19th, 2001, 06:35 AM
#2
Re: checking database tables
You could trap any error that occurs - if one does then the table does not exist, i.e
On Error Goto notExist
strSql = "Select * from <table>"
db.execute strSql
resumeNext:
notExist:
tableNotExist = true
resume resumeNext
Andrew
-
September 19th, 2001, 06:52 AM
#3
Re: checking database tables
If you are using Access you can execute the following SQL
Select Name from MSysObjects where Type = 1
1-All tables
2-System Databases
3-Objects(Tables,Dtabase,Relationships,Forms,Modules,SysRelationships,Scripts)
4-ODBC linked tables
5-Queries
6-Access linked tables
Iouri Boutchkine
[email protected]
-
September 19th, 2001, 07:22 AM
#4
Re: checking database tables
if still a problem, this worked for me,
'Load tables/Recordsets
With db
Err.Clear
set rsCatalog = .OpenRecordset(AP_rsCATLG, dbOpenDynaset)
If Err.Number = 3078 then
'add table
GetMissingTable "CatalogOrders"
set rsCatalog = .OpenRecordset(AP_rsCATLG, dbOpenDynaset)
Err.Clear
End If
Elizabeth
-
September 19th, 2001, 08:42 AM
#5
Re: checking database tables
thanks people, i went for the error trap method in the end
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|