DoCmd.TransferDatabase in VB Code

L

Larry

I have code behind a button click that transfers a table
from a database on a floppy disk into the current database.

It reads
DoCmd.TransferDatabase acImport, "Microsoft
Access", "a:\Bakers.mdb", acTable, "bakers", "bakers",
False

I want the user to be able to specify a path to the
database rather than hard code to the floppy drive. The
database has been emailed for about 2 years and the user
has to copy it to a floppy to import it.

Thanks for any help.
Larry
 
J

John Nurick

Hi Larry,

Use the code at http://www.mvps.org/access/api/api0001.htm to display
the standard File Open dialog to get the filespec to substitute for the
hard coded one.

If the file is always going to be "Bakers.mdb" and you just want the
folder, see http://www.mvps.org/access/api/api0002.htm

I have code behind a button click that transfers a table
from a database on a floppy disk into the current database.

It reads
DoCmd.TransferDatabase acImport, "Microsoft
Access", "a:\Bakers.mdb", acTable, "bakers", "bakers",
False

I want the user to be able to specify a path to the
database rather than hard code to the floppy drive. The
database has been emailed for about 2 years and the user
has to copy it to a floppy to import it.

Thanks for any help.
Larry

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
L

Larry

Thanks, I'll check that out.
Larry
-----Original Message-----
Hi Larry,

Use the code at
http://www.mvps.org/access/api/api0001.htm to display
the standard File Open dialog to get the filespec to substitute for the
hard coded one.

If the file is always going to be "Bakers.mdb" and you just want the
folder, see http://www.mvps.org/access/api/api0002.htm

I have code behind a button click that transfers a table
from a database on a floppy disk into the current database.

It reads
DoCmd.TransferDatabase acImport, "Microsoft
Access", "a:\Bakers.mdb", acTable, "bakers", "bakers",
False

I want the user to be able to specify a path to the
database rather than hard code to the floppy drive. The
database has been emailed for about 2 years and the user
has to copy it to a floppy to import it.

Thanks for any help.
Larry

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 
D

Daniel Hidalgo

I have a quick question on this. How would you do the file dialog in
conjunction with the Do.Cmd Function?

Thanks,

Dan
 

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