Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing table using vba

Status
Not open for further replies.

at51178

Technical User
Mar 25, 2002
587
0
0
US
Hey Guys

I would like to create a button on my form where when I click on it
it will let me import a table from another database.
 
DoCmd.TransferDatabase acImport, "Microsoft Access", "H:\Access\MDB\Firefly Migrate.mdb", acTable, "JobComments", "JobComments", False

Look in TransferDatabase Method in help.

You'll need to build an interface where users can specify values to go above, or it will be limited to importing the same table from the sam db repeatedly.
Regardless of how you fill its arguments, this is the code that will do the business.
A good cheat is to create the macro, then get it converted into code.

TransferDatabase Method Example

The following example imports the NW Sales for April report from the Microsoft Access database NWSales.mdb into the Corporate Sales for April report in the current database:

DoCmd.TransferDatabase acImport, "Microsoft Access", _
"C:\DBS\NWSales.mdb", acReport, "NW Sales for April", _
"Corporate Sales for April"
 
Thanks for the response


Can it be set up that when I click on the button a window pops up and let me browse through my harddrive and pick the database just like the same way it is being done when you right click in the database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top