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

  • Thread starter Thread starter joyo
  • Start date Start date
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
 
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.
 
Back
Top