Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005

    Unanswered: Using 2 Secured Dtabases in One Vb Prgm

    Hello All,

    I have the need to be able to open 2 differnt secured databases in one prgm, I do not need them open at the same time. The snippet of code below works fine for the first database I open

    DBEngine.SystemDB = "e:\netcab\Automated reports\apo.mdw"

    Set Myworkspace = DBEngine.CreateWorkspace("New", "aaaaaaa", "bbbbbb")
    ' Set db = DBEngine.Workspaces(0).OpenDatabase("e:\netcab\Aut omated reports\ecm daily.mdb")

    Set db = DBEngine.Workspaces(0).OpenDatabase("e:\netcab\Aut omated reports\apo.mdb")

    Set rs = db.OpenRecordset("Select * from USERS where USERS ='" & Strnbkid & "'" & " and [computer name]='" & StrComputername & "'" & " and scheduled='Y'")

    If rs.RecordCount > 0 Then

    Set rs = db.OpenRecordset("usage log", dbOpenTable)

    rs("Computer_Name") = StrComputername
    rs("nbk_id") = Strnbkid
    rs("Person_Name") = StrUsername
    rs("date_time") = Now
    rs("Authorized") = "Y"
    rs("Request to Run") = StrJobname
    Set db = Nothing

    Set Myworkspace = Nothing

    Now when I try to set up to open the next database with the code below

    DBEngine.SystemDB = "e:\netcab\Automated reports\ECM.mdw"

    The SystemDB never changes to the new MDW file thus causing a Logon failure when I continue with the rest ofthe code.

    How do you clear out the first Value for the dbengine.systemdb and replace with a new value.

    Please let me know any ideas you may have


  2. #2
    Join Date
    Aug 2005
    im not used to on how you make your codes, but is it possible if you close also the DBEngine set to nothing , then the workspace. some connections are very difficult to handle

  3. #3
    Join Date
    Jun 2005

    hope this will help

    Hi Try to close the first connection with the first DB
    and then open the connection with the second db
    and tehn make refresh to it

    hope that will work
    Sami Al Damiri ...

Posting Permissions

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