importing access tables into an access db

  • Thread starter Thread starter Amanda Kelly
  • Start date Start date
A

Amanda Kelly

I have the following code for a click event on a command button:

Private Sub Command86_Click()
On Error GoTo err_command10_click

Dim strfile As String


strfile = InputBox("Please enter the full path and file name including the
extension of the Access database that contains the data to be imported.")


DoCmd.TransferDatabase acImport, "Microsoft Access", strfile


exit_command10_click:
Exit Sub

err_command10_click:
MsgBox Err.description
Resume exit_command10_click

End Sub

---------------------------------------------

i get an error message that says "" The Microsoft Jet database engine could
not find the object ". Make sure that the object exists and that you spell
its name and path name correctly."

I am copying and pasting the properties of the file (path and name) directly
out of the directory into the input box. So I cannot be mispelling it.

Any help would be graciously appreciated...


Thanks,
 
The TransferDatabase method requires a few more parameters: you must specify
what type of object you're importing (acTable in your case), the name of the
object in the source database and the name you want to use for the object in
the destination database. You also have a choice of specifying if you want
only the table structure imported without its data.
 
Back
Top