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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for reference to another db

Status
Not open for further replies.

merlynsdad

Programmer
Nov 18, 2010
175
US
I'm copying a table from another db to my db. I can't modify the other db. My code is

DoCmd.CopyObject , "tblName1", acTable, "path tblName"

I don't code Access that much and know I have a syntax problem referring to the path and other table name, since Access can't find it, but cannot remember or find a reference to what the proper syntax should be.



If the square peg won't fit in the round hole, sand off the corners.
 
I'd use the DoCmd.TransferDatabase method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I only need to copy two tables out of a fairly large database. Why the TransferDatabase method as opposed to the CopyObject method?

If the square peg won't fit in the round hole, sand off the corners.
 
CopyObject is for copying an object from the current db to another db.
A starting point:
Code:
DoCmd.TransferDatabase acImport, "Microsoft Access", "\path\to\database.mdb", acTable, "tblName1", "tblName1"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top