Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

assign password to existing access database through vb at runtime

Posted on 2003-11-23
6
Medium Priority
?
251 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

927 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