Verifying the existence of a table in Access VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

How do I verify the existence of a table object l before I issue
a "DoCmd.DeleteObject" from within a VBA module ?
 
Hi;

How do I verify the existence of a table object l before I issue
a "DoCmd.DeleteObject" from within a VBA module ?

Why? Just trap the error.

On Error GoTo Err_Handler
Docmd.DeleteObject acTable, "ATableName"

Exit_Sub:
Exit Sub
Err_Handler:
If Err = 7874 then
Else
MsgBox "Error " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub
 
You can iterate through the tabledefs collection,
or do a select query on the MsysObjects table.

Why would you want to delete an Object? There is
probably a better way to organise your program.

(david)
 
Back
Top