How to protect access table using password - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.