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
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