check whether a table exists before running a macro

chthomas

Registered User.
Local time
Today, 00:48
Joined
Feb 8, 2000
Messages
32
Hi,

Could any one tell me how to check whether a table exists before running a macro? ie if the table exists don't run the macro else run the macro.

Regards,

Charley
 
Use this code

on error resume next
dim lCount as Long
dim stTable as String
stTable = "tblOLE"
lcount = currentdb.TableDefs(stTable).RecordCount
if err.Number = 3265 then
Msgbox "Table does not exist"
else
Msgbox "Table exists"
end if
 

Users who are viewing this thread

Back
Top Bottom