runtime error 3125 invalid name

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
 
B

bcap

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.
 
K

Kou Vang

Thanks. I was totally making the help look harder than it was. It's working
now.

Kou
 

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