chthomas Registered User. Local time Today, 07:37 Joined Feb 8, 2000 Messages 32 Feb 22, 2000 #1 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
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
Travis Registered User. Local time Yesterday, 23:37 Joined Dec 17, 1999 Messages 1,332 Feb 26, 2000 #2 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
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