Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Dec 2002
    Location
    Bruges, Belgium
    Posts
    122
    Thanks
    14
    Thanked 2 Times in 2 Posts

    Opening an Encrypted Access Database in VBA

    Access data base created with access 2010, encrypted and opened in access 2016
    Following code is used (in EXCEL) to open the data base:
    Code:
    Dim strProvider As String
    strProvider = "Microsoft.ACE.OLEDB.12.0"
    Dim strCon As String
    strCon = "Provider = " & strProvider & ";" & _
        "Data source = " & strDBFullName & ";" & _
        "Jet OLEDB:Database Password = '" & strDBCode & "';"
        
    Dim conDB As ADODB.Connection
    Set conDB = New ADODB.Connection
    With conDB
        .ConnectionString = strCon
        .CursorLocation = adUseClient
        .Open
    End With
    EXCEL is called by a form within the same already opened data base.

    The program gets stuck at the Open statement with following error message:
    2016-05-02_17-02-57.png

    The connection string is:
    Code:
    ?strcon
    Provider = Microsoft.ACE.OLEDB.12.0;Data source = Y:\GRXXX\GRXXX.accdb;Jet OLEDB:Database Password = ' ****** ********** ****';
    Password (encryption key) does contain blank spaces. Any help would be greatly appreciated.
    Attached Images Attached Images

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Woody,

    It appears to me to be a non-standard circular reference!

    That is, Access calling Excel calling back to the same Access Database.

    There is no good reason IMHO to do this. You can easily write code inside Access to open and control Excel thus eliminating this dog chasing his own tail scenario.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

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