Why I keep getting the error message when I use 'transferDatabase'

J

joyo

I tried to transfer the Excel files or Access tables to my
database. I used 'transferDatabase' with error control,
but I don't why I just keep getting the error message. How
can I know the file or table was transfered sucessfully
without any error. Below is my testing code.

Private Sub Command1_Click()
On Error GoTo Error_Handler
DoCmd.TransferDatabase acImport, "Microsoft Access", _
"C:\MyFolder\MyDB.mdb", acTable, "tbl_MyTable", _
"MyTest"
Error_Handler:
Debug.Print Err.Description; ""
Resume Next
End Sub

The error message was "Resume without error". We suppose
there was no error happening, but why it the code entered
the error control every time.

Thanks

joyo
 
A

Alphonse Giambrone

Sipmply put, lines of code will execute in sequence.
There was nothing to stop the execution of the code after your Error_Handler
line.
You only want those lines to execute in case of an error.
 

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