Error handling not working

E

Eric Lommatsch

I have a button on a form that when the user clicks it I
want to check if a table exist and if the table does exist
delete the table. What I am attempting to do is to create
a recordset for the table. If the Table doesn't exist I
should get an error "3078: The Microsoft jet database
engine cannot find the input table or
query 'AVI_Jul_03_all_yearly'. Make sure that it exists
and that the name is spelled correctly". I have added
error handling code that looks for this error message and
will resume execution of code after the point where the
table is deleted. For some reason this code is not being
executed when I run the program. Here is a sample of what
I am trying to do.

Private Sub Command36_Click()
On Error GoTo cmd_36_err
Dim rst As Recordset
Dim strtable As String
Set rst = db.OpenRecordset(strtable)
Set rst = Nothing
DoCmd.DeleteObject acTable, strtable
Transfer_Table:
DoCmd.TransferDatabase acImport, "Microsoft
access", "N:\westwood\NSS\NSS
Dev\NSS_New_Questions_AVI.mdb", acTable, "AVI", strtable

cmd_36_exit:
MsgBox "The Tables are setup for processing the
summary reports", vbInformation, "Process Done"
Exit Sub

cmd_36_err:
If Err.Number = 3078 Then
GoTo Transfer_Table
End If
End Sub

Does anybody have any suggestions?

Thanks

Eric Lommatsch
 

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