Results 1 to 3 of 3

Thread: Database Password?

  1. #1

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Question

    Is it possible to set and unset MS Access database password from VB ?

    Kinjal

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Sure thing!
    Here's to code to SET the password from VB:
    Code:
    Dim dbs As Database
    ' the True argument below opens the DB in EXCLUSIVE
    ' mode, required for setting password
    Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", True)
    dbs.NewPassword = "", "topsecret"
    dbs.Close
    Here's to code to OPEN the password-protected DB from VB:
    Code:
    Dim dbs As Database
    Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", _
                           False, False, ";pwd=topsecret")
    Here's to code to CHANGE the password from VB:
    Code:
    Dim dbs As Database
    Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", _
                           True, False, ";pwd=topsecret")
    dbs.NewPassword = "topsecret", "ultrasecret"
    dbs.Close
    Here's to code to UNSET the password from VB:
    Code:
    Dim dbs As Database
    Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", _
                           True, False, ";pwd=ultrasecret")
    dbs.NewPassword = "ultrasecret", ""
    dbs.Close
    enjoy!


    "It's cold gin time again ..."

    Check out my website here.

  3. #3

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    Thank you very very much.



    Kinjal

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