Verifying the existence of a table in Access VBA

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 ?
 
F

fredg

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
 
G

Guest

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top