Howdy, Stranger!

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

Categories

Connecting password protected access database

Hi,
[b]1.[/b] Connecting a password protected access database using ADODB.Connection , using Microsoft JET 4.0 OLEDB as provider gives me error. Pls help.


[b]2.[/b] How do I change password of access database using application developed in VB 6.0

Comments

  • dokken2dokken2 Member Posts: 532
    : Hi,
    : [b]1.[/b] Connecting a password protected access database using
    : ADODB.Connection , using Microsoft JET 4.0 OLEDB as provider gives
    : me error. Pls help.
    :
    :
    : [b]2.[/b] How do I change password of access database using
    : application developed in VB 6.0
    :


    here's how to connect to a password protected db. dont know how to change the password.

    [code]
    access a database with a password on the database

    '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=====================
    [/code]
Sign In or Register to comment.