Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to protect access table using password

swetha rahulswetha rahul Posts: 4Member
Hi

I wnat to know how to protect the MDB file using password. In Access how to give password. please anybody help me. In VB coding i have written userid and password for access table in connection string. But its not working.

Comments

  • dokken2dokken2 Posts: 532Member
    : Hi
    :
    : I wnat to know how to protect the MDB file using password. In Access how to give password. please anybody help me. In VB coding i have written userid and password for access table in connection string. But its not working.
    :

    the userid/password will work if you set up workgroup security, use the "user level security wizard" and keep a backup copy just in case. i would recommend reading the on-line help and microsoft knowledge base so you understand the process.
  • nasserahmednasserahmed Posts: 2Member
    Hi There,

    'Open the database "C:example.mdb" in exclusive mode
    'Click On Tools/Security/Set Database Passowrd
    'Type and re-type the password as "mypass"
    'Since we are using mypass as an example

    'Open a New VB Project and use the following code
    'Dont Forget to referance to "Microsoft ActiveX Data Objects 2.5
    'Library
    '==============CODE START=====================
    Dim AdoConn As New ADODB.Connection
    Dim AdoRs As New ADODB.Recordset

    Private Sub Form_Load()
    On Error GoTo Form_Load_Error

    Dim AdoDatabasePath As String
    Dim AdoPassword As String

    AdoDatabasePath = "C:Example.mdb"
    AdoPassword = "mypass"

    If AdoConn.State = 1 Then AdoConn.Close

    AdoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Password='';" & _
    "User ID=Admin;Data Source=" & AdoDatabasePath & ";" & _
    "Jet OLEDB:Database Password='" & AdoPassword & "'"


    On Error GoTo 0
    Exit Sub

    Form_Load_Error:
    MsgBox "Error :" & Err.Number & vbNewLine & "Description: " & Err.Description & vbNewLine & "Procedure: Form_Load" & vbNewLine & "Module Type: Form" & vbNewLine & "Module Name: Form1"

    End Sub
    '==============CODE END=====================


    Have Fun !!
    Nasser


Sign In or Register to comment.