Hi,<br>
Could any one suggest 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.<br>
Regards,<br>
Charley
Well you could create a VBA function.<br>
like this:<br>
---------------------------------<br>
Public Function sample()<br>
On Error GoTo Err_Sample<br>
DoCmd.OpenTable "Tablename"<br>
'if the the table dose not exist then it will return an Error 7874<br>
Exit_Sample:<br>
Exit Function<br>
<br>
Err_Sample:<br>
Select Case Err.Number<br>
Case 7874<br>
' Table not found<br>
DoCmd.RunMacro "MacroName"<br>
Case Else<br>
MsgBox "Error # " & Err.Number & " " & Err.DESCRIPTION, vbInformation, "In sub xxxxxxxxxx"<br>
Resume Exit_Sample<br>
End Select<br>
<br>
End Function<br>
------------------------------------- <p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.