A
Afrosheen
Could someone please look at this and tell me what is wrong.
What I'm trying to do is once I click on a text box in the main menu I want
it to trigger the password form. Once the information is checked and verified
then it will go back to the main menu and unload the forms so I can get to
the programs.
What it is doing is once the text box is pressed then the password form
comes up then returns to the main menu. It does not stop to ask the questions.
This is the code for the textbox click:
Private Sub svt01_Click()
Dim stdocname As String
strdocname = "frmpass"
DoCmd.OpenForm strdocname, acNormal
MsgBox "it is not working"
'DoCmd.Close acForm, "frmpass" 'Closes the password window
DoCmd.Close
Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = True
Next I
DoCmd.SelectObject acTable, , True
End Sub
This is the code for the password form
Private Sub Pword_AfterUpdate()
Dim strUser As String
strUser = username
MsgBox "im waiting"
If StrComp(Me.Pword, Nz(DLookup("Password", "tblpass", "User=" & """" &
strUser & """"), ""), 0) = 0 Then
MsgBox "hi there. Your In."
strUser = ""
username = ""
Pword = ""
Exit Sub
Else
Call MsgBox("Oh Oh!! You Didn't Say The Magic Word!!", vbCritical,
Application.Name)
strUser = ""
username = ""
Pword = ""
End If
End Sub
In the password form I have two text boxes. One called User and the other is
Password.
Thanks for reading this.
What I'm trying to do is once I click on a text box in the main menu I want
it to trigger the password form. Once the information is checked and verified
then it will go back to the main menu and unload the forms so I can get to
the programs.
What it is doing is once the text box is pressed then the password form
comes up then returns to the main menu. It does not stop to ask the questions.
This is the code for the textbox click:
Private Sub svt01_Click()
Dim stdocname As String
strdocname = "frmpass"
DoCmd.OpenForm strdocname, acNormal
MsgBox "it is not working"
'DoCmd.Close acForm, "frmpass" 'Closes the password window
DoCmd.Close
Dim I As Integer
For I = 1 To CommandBars.Count
CommandBars(I).Enabled = True
Next I
DoCmd.SelectObject acTable, , True
End Sub
This is the code for the password form
Private Sub Pword_AfterUpdate()
Dim strUser As String
strUser = username
MsgBox "im waiting"
If StrComp(Me.Pword, Nz(DLookup("Password", "tblpass", "User=" & """" &
strUser & """"), ""), 0) = 0 Then
MsgBox "hi there. Your In."
strUser = ""
username = ""
Pword = ""
Exit Sub
Else
Call MsgBox("Oh Oh!! You Didn't Say The Magic Word!!", vbCritical,
Application.Name)
strUser = ""
username = ""
Pword = ""
End If
End Sub
In the password form I have two text boxes. One called User and the other is
Password.
Thanks for reading this.