how do i write a macro for password protecting my access database, by creating a separate table for username and password so that more than one users can be authorized to access the database and also the password sanctity is maintained by assigning separate username and password for each user
password protection
Collapse
X
-
You can do it.
1. Create a table called login has @list to field UserId and Password.
2. Create a unbound form for login having two text box (UserID and Password) and two button (Log in and Cancel).
3. Create a select query on login table that takes two parameters for loginid and password from the login form.
4. Create a form from the query created.
5. Make the queried form a sub form of the login form that not visible.
6. Now Add a Macro to the login captioned button in login form.
The marcro steps are given bellow.
a. MsgBox in action if user id not given.
b. StopMacro in action if user id not given.
c. MsgBox in action if password not given.
d. StopMacro in action if password not given.
e. Requery in action
f. MsgBox in action if user id and password in login form and user id and password in sub form not matched.
or
if user id and password in sub form null
g. StopMacro in action if user id and password in login form and user id and password in sub form not matched.
or
if user id and password in sub form null
h. MsgBox in action if user id and password in login form and user id and password in sub form matched.
or
if user id and password in sub form not null
i. Close in action with object selected form, name selected login form name
j. OpenForm in actin with object selected form, name selected form name that you like to open.
Hope it's help you. :)
Comment