Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    5

    Unanswered: proctecting database?

    If I supply an .mdb file with my program, that is used to store all of the user's data, then how can I protect the file from being accessed by the user? Since the database file would most probably be stored in the same folder as the program, any user with Micrsoft Access installed could open it up and mess with the database. How can I protect that from happening?

    If you are going to say, use a password, then please tell me how to connect to a password protected access database using ADO 2.5. The connection string I'm using right now is:
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path_to_db
    Thanks.

  2. #2
    Join Date
    Nov 2004
    Posts
    3

    Database Passwords with Access

    Here is the code I use to open access .MDB files via Visual Basic. Load the Access file in Access and assign it a password, then in the code below, where it says password, change it to match the MDB file. Hope this helps

    Mike

    Sub OpenDataBase()

    Dim fs As Object
    Set fs = CreateObject("Scripting.FileSystemObject")

    'Check for DataBasePath File before proceeding
    If fs.FileExists(DatabasePath) Then

    Set cnFMPCS = New ADODB.Connection
    ' OPEN THE DATABASE
    With cnFMPCS
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .Properties("Jet OLEDBatabase Password") = "passwordhere"
    .Mode = adModeReadWrite

    .Open DatabasePath, "admin"
    End With

    DatabaseFoundFlag = True


    Else

    DatabaseFoundFlag = False

    End If

    Set fs = Nothing

    End Sub
    Last edited by USPS87; 11-26-04 at 15:41.

  3. #3
    Join Date
    Nov 2004
    Posts
    3

    Provider Correction

    Here is a correction for the following line in my previous post. For some reason this message software put a smiley face in after OLEDB in place of the colon.

    .Properties("Jet OLEDBatabase Password") = "passwordhere"

    Note, between OLEDB and Database you need to put in a colon, in place of the smiley face.

    Mike
    Last edited by USPS87; 11-26-04 at 15:39.

Posting Permissions

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