Table Recognition

  • Thread starter Thread starter Charlie
  • Start date Start date
C

Charlie

How can I determine if a table exists programically? I
want to make sure a table exists before deleting it.
 
Why not just drop the table and trap for the error if it didn't exist?

Ron W
 
Using the application object
dn catching the error

for ADP
Application.CurrentProject.AllForms.Item(<Form_Name>).Name

for MDB
Application.CurrentDB.AllForms.Item(<Form_Name>).Name
 
I agree with the rest just delete the table and continue on
with any other processing. Here is some code example

Private sub.......
On Error Resume Next

DoCmd.DeleteObject acTable, "tablename1"
DoCmd.DeleteObject acTable, "tablename2"

' Insert your other processing needs

Update_Data_Exit:
Exit Function

Update_Data_Err:
MsgBox Error$
Resume Update_Data_Exit

ens sub

Jim
 

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

Back
Top