Solved

assign password to existing access database through vb at runtime

Posted on 2003-11-23
6
229 Views
Last Modified: 2013-12-25
i have an  mdb in access, to make it secure, i want a code in vb6 which will assign password to mdb, so when user opens the database exclusively , it shld ask for the password.in access security under which password set property is there, i want to set that property but through vb
0
Comment
Question by:tanvi
6 Comments
 
LVL 8

Expert Comment

by:MYLim
ID: 9809024
i do like this:
1.Set password to Access database. (Ex:Password = Admin)
2.i will create a Password field to Chk user Login - MyUsername,MyPassword,MyLevel.
   (EX:Username = tanvi ,Password = 123 ,Level = Administrator)
3.When Program start then i will use Password 'Admin' to Connect to Access.
4.After Connect Access,i can retrieved data from access then compare with username,
 password which User Enter.
EX: if txtUsername.text <> RsFromAccessDatabase.fields(MyUsername) and
          txtPassword.text <> RsFromAccessDatabase.fields(MyPassword)  then
        msgbox "Inccorrect Password,Try again"
       else
           LoginSuccessed = true
           form1.show
       end if

0
 
LVL 8

Expert Comment

by:MYLim
ID: 9809043
as i know,Access only can have one password.
0
 

Author Comment

by:tanvi
ID: 9809534
i want to set access password,at runtime, not like this
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 50 total points
ID: 9810022
In that case you can assign a password in Access.  Then your application should display a form which asks the user for password and user information.  You should then use this information as part of the concatinated connection string then you try to access Access:

strUser = Trim(txtUsername.Text)
strPass = Trim(txtPassword.Text)

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:\somepath\mydb.mdb;" & _
           "Jet OLEDB:System Database=MySystem.mdw", strUser, strPass


Leon
0
 
LVL 1

Expert Comment

by:ayufans
ID: 10512115
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- answered by leonstryker

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

ayufans
Cleanup Volunteer
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now