Proofread my statement please

AtLarge

Registered User.
Local time
Today, 15:16
Joined
Oct 15, 2008
Messages
70
I want it to check for a table called DOWNWU_ImportErrors and if found delete it. If not found go on with the rest of the script. I really would like it to just delete all the tables but I couldn't figure out a way to make that work so I have to be specific on the table names for now.

If DOWNWU_ImportErrors = 0 Then
DoCmd.DeleteObject acTable, "DOWNWU_ImportErrors"
End If

The problem is if it doesn't find the table it puts up the dialogue box that it wasn't found. I switched it to the = 1 and it didn't seem to make any difference. I also have the Echo and Setwarnings off. Am I missing something here :confused:
 
A simpler method (and very valid, using the Error collection as an aide):

Code:
On Error GoTo Err_Handler

DoCmd.DeleteObject acTable, "DOWNWU_ImportErrors"

Err_Handler_Exit:
   Exit Sub

Err_Handler:

If Err.Number <> 7874 Then
   MsgBox Err.Description, vbExclamation, "Error Number: " & Err.Number
End If
   Resume Err_Handler_Exit
 
Thanx Bob. I'll try that instead. :)
 

Users who are viewing this thread

Back
Top Bottom