Results 1 to 2 of 2
Thread: Export Tables (2000)
2004-02-24, 11:49 #1
- Join Date
- Jun 2001
- Kenton, Delaware, USA
- Thanked 0 Times in 0 Posts
Export Tables (2000)
I am trying to get a bit of code to export a table from one Access dB to another. I do have the basic line.
DoCmd.TransferDatabase acExport, "Microsoft Access", "*******DATABASES$Bill FolderCopyUCCVisits.mdb", acTable, "tblVisitLog", "tblVisitLog", 0
The code works fine until I try and add a password for the target dB.
I have attempted to add "Microsoft Access;pwd=password " that gave me an error message 'Not an acceptable object for this argument'.
I have also tried to add it to the target dB path "*******DATABASES$Bill FolderCopyUCCVisits.mdbpwd=password " the error message I get here is 'Can't find database by that name'.
Any ideas on what I am doing wrong?
2004-02-24, 12:12 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Export Tables (2000)
TransferDatabase does not support passwords. You must use DAO to open the target database first. Make sure that you have a reference to the Microsoft DAO 3.6 Object Library (in Tools | References...). Then use code like this:
Dim dbs As DAO.Database
Set dbs = DBEngine.OpenDatabase("*******DATABASES$Bill FolderCopyUCCVisits.mdb", _
False, False, ";pwd=secret")
DoCmd.TransferDatabase acExport, "Microsoft Access", "*******DATABASES$Bill FolderCopyUCCVisits.mdb", _
acTable, "tblVisitLog", "tblVisitLog"
Set dbs = Nothing