Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password setup for restricted forms?

Status
Not open for further replies.

jac123

Technical User
Apr 25, 2003
19
US
I have set up my database with several forms that can be viewed but no changes can be made on them. In order for the user to make changes, they need to select an Add/Edit button on the toolbar, which opens a restricted dialog box, asking the user for his password. When the correct password is given, an Edit form open, where the user can make changes to the DB. Below is the code I placed in the Load form of each of the Edit forms.
What I want to be able to do is on my “Introduction” form, which only appears the first time the user opens the DB, is to set the “password” the user types in on the Introduction form.
From my reading, sounds as though I need to create a Module to run from the introduction form. I have never created a Module. Any help would be greatly appreciated.
I have looked thru the examples, and am not able to find anything on this subject. Perhaps, I’m not typing in the
appropriate words.


Private Sub Form_Load()
Dim strPasswd
Dim BaptismEdit As Form

strPasswd = InputBox("Enter Password", "Restricted Form")

If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
DoCmd.Close acForm, "Baptism Edit"
Exit Sub
End If

If strPasswd = "Morton" Then
DoCmd.OpenForm "Baptism Edit", acNormal
Else
MsgBox "Sorry, you do not have access to this form", vbOKOnly, _
"Important Information"
DoCmd.Close acForm, "Baptism Edit"
Exit Sub
End If
End Sub
 
Check out faq222-2244 first to see if you are in the right forum. From your use of DoCmd and acForm (and your other questions) it looks as if this is a VBA from Access rather than a VB6 question. If so you will do better in forum702 which is specifically for Access Forms questions.

The FAQ also gives guidance on forum usage and etiquette

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top