Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    open db with password (Access 2000)

    I need to add on a code for opening a database and a form within database that is protected
    with the password "secret". The function is called FncConvert, and it works fine with databases
    that are not protected.Can somebody help me with adding a code for opening a database protected with the word "secret"?

    The function is as follows:

    Public Function FncConvert()
    Dim appAccess As Access.Application
    Set appAccess = CreateObject("Access.Application.9")
    appAccess.OpenCurrentDatabase (Auf)
    appAccess.DoCmd.OpenForm "F1", acNormal
    appAccess.Visible = True
    appAccess.UserControl = True
    End Function

    Ususally i can open a protected database with DAO in the following way:

    Dim StrPassword As String
    StrPassword = "secret"
    Dim db As DAO.Database
    Set db = DBEngine.Workspaces(0).OpenDatabase(BEpath, dbDriverComplete, False, "; PWD=" & StrPassword)

    However i cannot apply this code in the function that open a databasde and after that opens a form called F1.
    I will be very grateful for the help.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: open db with password (Access 2000)

    Have you tried your standard code plus the OpenCurrentDatabase method? It allows you to open an existing database as the current database, which then allows you to use things like DoCmd.OpenForm.

Posting Permissions

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