Results 1 to 7 of 7
  1. #1
    Terry Lawson is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    23

    Importing Multiple Tables from a Protected Access Database

    All



    I need to import and not link eight tables from another password protected database.

    I'm trying to use for e.g:
    DoCmd.TransferDatabase acImport, "Microsoft Access", "C:\test\test_data.mdb", acTable, "tblMember", "tblImportedMember", , True 'member table

    If I then follow the above with say:
    DoCmd.TransferDatabase acImport, "Microsoft Access", "C:\test\test_data.mdb", acTable, "tblCountry", "tblImportedCountry", , True 'country table

    I get asked twice for the password for the protected database from which I'm importing.

    Is there a mechanism for just inputting the password once?

    I suspect that I don't understand fully understand the StoreLogin function or is that a red herring?

    Help/assistance from you guys would be much appreciated.

    Regards

    Terry Lawson

  2. #2
    llkhoutx is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Take a look at this URL.

  3. #3
    Terry Lawson is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    23
    Sorry to take so long to respond, I've tried what I know but to no avail

    URL gives details for Excel import, I'm not clever enough to convert that code to solve my problem

    Any further suggestions?

    Regards

    Terry Lawson

  4. #4
    llkhoutx is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Heres's another URL which imports from a password protected database.

  5. #5
    Terry Lawson is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    23

    Post

    I'm still struggling

    I've pasted the code from the link you have given me with my (mis)understandings on the same row.

    Set oAcc = New Access.Application 'set a new Access application
    Set db = oAcc.DBEngine.OpenDatabase(strForeignDB, False, False, ";PWD=" & strProjPW) 'set a new database named strForeignDB with password = strProjPW

    oAcc.OpenCurrentDatabase strForeignDB 'open the new strForeignDB database (with password from set db above)
    oAcc.DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentProject. 'import the table "t0zAA" from currentproject.fullname to "t0ZRBB" which will be in StrForeignDB
    FullName, acTable, "t0ZAA", "t0ZRBB", True 'I think that currentproject.fullname is the database that this code is run in?


    I think that this does the reverse of what I need, that is the code as written imports tables into a protected database, I want to import tables into the database that the code is run in from a password protected database.
    I've tried to do the obvious and used oAcc.Docmd.TransferDatabase acExport etc. but still get problems.

    I'm sorry if I'm a pain, but I'm very much a self taught novice.

    Further help would really be appreciated.

  6. #6
    llkhoutx is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Without my deciphering you code, what happens when you run what you've posted?

  7. #7
    Terry Lawson is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    23
    I've changed the code slightly it is now:

    Dim oAcc As Application
    Dim db As Database
    Dim strForeignDB As String
    Dim strProjPW As String
    Dim temp As String


    strProjPW = "splendid"
    strForeignDB = "C:\SFHG\sfhg_data.mdb"

    Set oAcc = New Access.Application
    Set db = oAcc.DBEngine.OpenDatabase(strForeignDB, False, False, ";PWD=" & strProjPW)


    oAcc.OpenCurrentDatabase strForeignDB

    temp = CurrentProject.FullName

    oAcc.DoCmd.TransferDatabase acImport, "Microsoft Access", CurrentProject.FullName, acTable, "tblMember", "Importmember", True

    Set db = Nothing
    Set oAcc = Nothing

    temp returns as expected the name of the database running the code.

    I'm getting error 3011 "tblMember not found", but I'm certain it's there.
    I've tried expanding the table to be copied to strForeignDB & "\tblMember" and get the same error (3011).

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-15-2014, 06:43 PM
  2. Importing XML with XSLT to multiple tables without unique key
    By ObstructedBelt in forum Import/Export Data
    Replies: 3
    Last Post: 06-27-2012, 01:21 PM
  3. Replies: 4
    Last Post: 01-31-2012, 12:42 PM
  4. Importing Excel datasheets into multiple tables
    By FishMT in forum Import/Export Data
    Replies: 3
    Last Post: 02-08-2011, 07:44 AM
  5. Replies: 0
    Last Post: 10-22-2007, 02:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums