Including password in import code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RachH
    New Member
    • Mar 2008
    • 15

    Including password in import code

    I import tables from one Access 2003 database into another 1x/day (for various reasons, linking tables does not meet the need). The database I am importing from is password protected at the general level so I am asked for a password with each table I import. Is there a way to include the password in the import code? My VBA import code is as follows:

    Code:
    DoCmd.TransferDatabase acImport, "Microsoft Access", _
        "c:\Pdb.mdb", acTable, "Price", "PriceNew"
    I've been looking through these and other forums for a couple of days to find a solution and either I'm not savvy enough to recognize the solution when I see it (sadly possible) or the answer is not as easy as I first thought it would be. Any ideas?
  • PianoMan64
    Recognized Expert Contributor
    • Jan 2008
    • 374

    #2
    Originally posted by RachH
    I import tables from one Access 2003 database into another 1x/day (for various reasons, linking tables does not meet the need). The database I am importing from is password protected at the general level so I am asked for a password with each table I import. Is there a way to include the password in the import code? My VBA import code is as follows:

    Code:
    DoCmd.TransferDatabase acImport, "Microsoft Access", _
        "c:\Pdb.mdb", acTable, "Price", "PriceNew"
    I've been looking through these and other forums for a couple of days to find a solution and either I'm not savvy enough to recognize the solution when I see it (sadly possible) or the answer is not as easy as I first thought it would be. Any ideas?
    The TransferDatabas e function/macro doesn't support password protected databases.

    If you know the password to the database, then you can open the database in DAO (Data Access Object) and give it the password to the database, and then run a query to import the table(s) that you need.

    If you need to have code examples, let me know. Otherwise the best place to find out how to do it is the Microsoft Support SIte

    Comment

    • RachH
      New Member
      • Mar 2008
      • 15

      #3
      Great! Thanks so much for your help.

      Comment

      • brittany1
        New Member
        • Jun 2010
        • 8

        #4
        Hi, I have the same problem, Our server is too slow so
        linking tables is not an option. I am therefor using a macro to importing several tables from a Access DB based on our server which is Password Protected. I have the password put have to enter it 6 times one for each table
        can this be done with code. Please help.

        Comment

        Working...