Results 1 to 7 of 7

Thread: Password protected access database

  1. #1
    Guest

    Question

    ive got an access database which i want to be password protected, how do i access this through VB6? ive tried MSDN and i cant seam to find nething

    thanx in advance
    chenko

  2. #2
    Addicted Member JasonGS's Avatar
    Join Date
    May 2000
    Location
    California
    Posts
    155
    I got a possible answer fer ye...

    Set the database password in Access, and then to access it with ADO for instance...
    Code:
    Dim adoConn As New ADODB.Connection
    With adoConn
        .Provider = "Microsoft.Jet.OLEDB.4.0"
        .Open "c:\folder\file.mdb", "admin", "thatpassword"
    End With
    ...and now you are once again cool.

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Thumbs up

    If your access juz password protected without applied the Workgroup information, then this should be enough.

    Code:
    Dim adoConn As ADODB.Connection
    Set adoConn = New ADODB.Connection
    adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Password=MyPassword;Data Source=c:\MyDatabase.mdb;"

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Because Access maintains passwords in a security module, you have to pass that path in the connection string.

    i.e.
    "Provider=Microsoft.Jet.OLEDB.4.0;Password=password;User ID=user;Data Source=c:\MyDatabase.mdb;Jet OLEDB:System database=c:\security.mdw"

    Cheers,

    P.


    Not nearly so tired now...

    Haven't been around much so be gentle...

  5. #5
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    It occurs to me that you may mean a Database Password as opposed to a username/password. For that you need something like:

    "Jet OLEDB:Database Password=dbPassword;"

    in your connection string.

    Alternatively, are you trying to access Access through Automation? I cannot remember the code directly, but I will dig it out and post if you want it.

    Cheers,

    P.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  6. #6
    Guest

    yea database password

    yea i do mean database password!

    i use this to connect to my database

    Set DB = Opendatabase("c:\myfolder\file.mdb")

    the format is like this
    Set DB = Opendatabase("name as string",[options],[readonly],[connect])


    i looked at msdn and found that you can put a password in that peice but i can get it to work and i dont know exaclty the heck it is on bout

    thanx in advance
    chenko

  7. #7
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Oh... chenko, you're using DAO. then it should be look like this-

    Code:
    Set db = DAO.OpenDatabase("C:\1.mdb", False, False, ";pwd=1234")
    Assume your password is 1234




Posting Permissions

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



Click Here to Expand Forum to Full Width