runtime error 3125 invalid name

  • Thread starter Thread starter Kou Vang
  • Start date Start date
K

Kou Vang

I am trying to transfer one table from one access DB to another. I keep
getting an error at the final Destination criteria of the command call. It
says that "H:\LakeStorageDB.mdb" is not a valid name. Here is my code"

Option Explicit
Dim dlgOpen As FileDialog
Dim sPath As String

Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)

With dlgOpen

If .Show = -1 Then

'Step through each string in the FileDialogSelectedItems
collection
For Each vrtSelectedItem In .SelectedItems

sPath = vrtSelectedItem
Debug.Print sPath 'Prints sPath = H:\LakeStorageDB.mdb

Next vrtSelectedItem

Else
End If

End With

DoCmd.TransferDatabase acExport, "Microsoft Access",
"C:\temp\LakeDBproj.mdb", acTable, "LakeInfoObserv", sPath

Thanks,

Kou
 
You've misunderstood the usage of some of the arguments. The Destination
argument is supposed to be the name of the table you are exporting the data
into, not the name of the database file.

The name of the destination database file is the *3rd* argument,
DatabaseName. You don't need to (and cannot) specify the database you are
exporting *from*, it's assumed to be (i.e. it *must* be) the current
database.
 
Back
Top