M
merry_fay
Hi,
In my code, just in case something goes wrong, I use the error handling
method:
On Error GoTo ErrMsg
code...
ErrMsg:
MsgBox "There has been an error importing this file"
DoCmd.DeleteObject acTable, "Temp"
On this particular form, I'm creating a temporary link to an excel file
which means creating a Temp table in my database.
IF for some reason, there happened to be an error after this link had been
created, then this table has to be deleted or the next time the code was run,
it would create Temp1 which wouldn't work with my queries.
Of course, if an error happened before the link was created, then an error
would occur when deleting the table. I tried to solve this using:
ErrMsg:
MsgBox "There has been an error importing this file"
On Error GoTo ErrMsg2
DoCmd.DeleteObject acTable, "Temp"
ErrMsg2:
End Sub
This doesn't work though. Can anyone help please?
Thanks
In my code, just in case something goes wrong, I use the error handling
method:
On Error GoTo ErrMsg
code...
ErrMsg:
MsgBox "There has been an error importing this file"
DoCmd.DeleteObject acTable, "Temp"
On this particular form, I'm creating a temporary link to an excel file
which means creating a Temp table in my database.
IF for some reason, there happened to be an error after this link had been
created, then this table has to be deleted or the next time the code was run,
it would create Temp1 which wouldn't work with my queries.
Of course, if an error happened before the link was created, then an error
would occur when deleting the table. I tried to solve this using:
ErrMsg:
MsgBox "There has been an error importing this file"
On Error GoTo ErrMsg2
DoCmd.DeleteObject acTable, "Temp"
ErrMsg2:
End Sub
This doesn't work though. Can anyone help please?
Thanks