Run macro if table exists

esskaykay

Registered User.
Local time
Today, 04:23
Joined
Mar 8, 2003
Messages
267
I'm looking for a way to run a macro if a table exists, if not run a different macro. Something like:

If TableExists "tblONE"
DoCmd.RunMacro ("macONE")
Else
DoCmd.RunMacro ("macTWO")
End If

I see some of these mentioned here but I've been less than successful at getting them to work. Any help would be appreciated.

Thanks,
SKK
 
Dim tbd As TableDef
For Each tbd In CurrentDb.TableDefs
If tbd.Name = "tblONE" Then
DoCmd.RunMacro ("macONE")
Exit For
Else
DoCmd.RunMacro ("macTWO")
Exit For
End If
Next
 
Excellent - thank you very much,
SKK
 

Users who are viewing this thread

Back
Top Bottom