Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    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?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 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"
    dbs.Close
    Set dbs = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •