Results 1 to 2 of 2
  1. #1
    paul.holness is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    5

    Export to Remote DB VBA to OpenPasswordProtectedDB

    Hi, Below is the code to export to the BE. There are 32 tbls! How do I program using vbs to bypass or enter the password automatically?

    tbl_CA1InputNFileJanMar = "CA8InputFile_January_March_2013"
    tbl_CA1InputNFileAprJun = "CA8InputFile_April_June_2013"
    tbl_CA1InputNFileJulSep = "CA8InputFile_July_September_2013"
    tbl_CA1InputNFileOctDec = "CA8InputFile_October_December_2013"
    DoCmd.TransferDatabase transfertype:=acExport, _
    databasetype:="Microsoft Access", _
    databasename:="Z:\Turnaround Integrated Controls\1.4.12_Cost Control\Cost Performance Report\2013 Cost Performance Report\Performance Database\Data Database\TA2013_PR_TrackingDB.accdb", _


    ObjectType:=acTable, Source:="" & tbl_CA1InputNFileJanMar & "", _
    Destination:="" & tbl_CA1InputNFileJanMar & "", structureonly:=True

    Here I found the Compact and Repair script using the feature I want, but do n ot know how to incorporate it:


    Sub OpenPasswordProtectedDB()
    'Define as Static so the instance of Access
    'doesn't close when the procedure ends.
    Static acc As Access.Application
    Dim db As DAO.Database
    Dim strDbName As String
    strDbName = "C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb"
    Set acc = New Access.Application
    acc.Visible = True
    Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=nwind")
    acc.OpenCurrentDatabase strDbName
    db.Close
    Set db = Nothing

    End Sub

    Here is another example I found:


    1. Public Function fODBCTablesRefresh() As Boolean
    2. ' This function refreshes the DAO ODBC table connections
    3. ' listed in the qryODBCRefreshList query
    4. ' which in turn lists the first table to be connected for each different
    5. ' connection string listed in table tblDatabasesConnected.
    6. '
    7. ' This function is used to automate the initial refresh of the ODBC table connection
    8. ' so that updates etc can run without user intervention to supply the UID and PWD components
    9. ' of the DB connection.
    10. '
    11. ' 23/4/09
    12. '
    13. On Error GoTo refresh_err
    14. Dim daoDB As DAO.Database
    15. Dim tdef As DAO.TableDef
    16. Dim RS As DAO.Recordset
    17. Dim strConnectOld As String
    18. Set daoDB = CurrentDb
    19. Set RS = CurrentDb.OpenRecordset("qryODBCRefreshList")
    20. Do While Not RS.EOF
    21. Set tdef = daoDB.TableDefs(RS![tablename])
    22. strConnectOld = RS![Connect String]
    23. tdef.Connect = strConnectOld & "; UID=" & RS![USER ID] & "; PWD=" & RS![CONNECTION PASSWORD]
    24. tdef.RefreshLink
    25. tdef.Connect = strConnectOld 'restore no-password version of connect string
    26. RS.MoveNext
    27. Loop
    28. RS.Close
    29. fODBCTablesRefresh = True
    30. Exit Function
    31. refresh_err:
    32. fODBCTablesRefresh = False
    33. End Function
    Last edited by paul.holness; 02-03-2013 at 03:27 PM.

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    Export to Remote DB ?? what is meant by that ?? either a db is linked or it is not - and if it is not there is no exporting to it.....and if it is linked there is no need to export.... am greatly confused by what it is that you are attempting to achieve.....

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

Similar Threads

  1. Remote Access
    By tired and frustrated in forum Access
    Replies: 3
    Last Post: 01-16-2012, 10:19 AM
  2. Remote Access
    By treva26 in forum Access
    Replies: 1
    Last Post: 09-03-2009, 06:56 AM
  3. How to Use Remote DB
    By saravanan.baskaran in forum Access
    Replies: 0
    Last Post: 01-10-2009, 03:43 PM
  4. Trying to check a remote connection!
    By Zermoth in forum Programming
    Replies: 1
    Last Post: 12-11-2008, 05:15 AM
  5. disconnected Remote Users?
    By Zermoth in forum Programming
    Replies: 0
    Last Post: 12-11-2008, 04:52 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