Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 18011
Number of posts: 55384

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to protect access table using password Posted by swetha rahul on 20 Jul 2006 at 12:02 AM
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.
Report
Re: How to protect access table using password Posted by dokken2 on 20 Jul 2006 at 5:10 AM
: 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.
Report
Re: How to protect access table using password Posted by nasserahmed on 24 Jul 2006 at 2:11 AM
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





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.