Hi,
I have an "OK" button that should open up a form based on the user's username and password, I also included an option box that gives the option to either view the form in an "Add Mode" or "Preview Mode". So the process should look something like this: username - password - select option - click "OK" to open form.
But when I type an username and a wrong password I am still able to open the form...Can someone take a look at the code below to see if I did anything wrong..thanks!!!!
Private Sub OK_Click()
If IsNull(Me.cbousername) Then
Exit Sub
Else
Dim strpass As Variant
strpass = DLookup("Password", "User", "[UserName] = cboUserName"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Dim strFlag As Variant
strFlag = DLookup("Systemadmin", "User", "[UserName] = cboUserName"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
If strpass = txtPassword Then
strGlobalUser = cbousername
strGlobalPass = strpass
strGlobalFlag = strFlag
DoCmd.Close
DoCmd.OpenForm "HelpDeskCalls", , , , acFormAdd
Forms!HelpDeskCalls![cboAssigned].Value = strGlobalUser
Else
MsgBox "Incorrect Username or Password entered.", vbOKOnly, "Logon Error"
If Frame19.Value = 1 Then
DoCmd.OpenForm "HelpDeksCalls", , , acPreview
Else
DoCmd.OpenForm "HelpDeskCalls", acNormal, [TicketNumber]
End If
End If
End If
End Sub
I have an "OK" button that should open up a form based on the user's username and password, I also included an option box that gives the option to either view the form in an "Add Mode" or "Preview Mode". So the process should look something like this: username - password - select option - click "OK" to open form.
But when I type an username and a wrong password I am still able to open the form...Can someone take a look at the code below to see if I did anything wrong..thanks!!!!
Private Sub OK_Click()
If IsNull(Me.cbousername) Then
Exit Sub
Else
Dim strpass As Variant
strpass = DLookup("Password", "User", "[UserName] = cboUserName"
Dim strFlag As Variant
strFlag = DLookup("Systemadmin", "User", "[UserName] = cboUserName"
If strpass = txtPassword Then
strGlobalUser = cbousername
strGlobalPass = strpass
strGlobalFlag = strFlag
DoCmd.Close
DoCmd.OpenForm "HelpDeskCalls", , , , acFormAdd
Forms!HelpDeskCalls![cboAssigned].Value = strGlobalUser
Else
MsgBox "Incorrect Username or Password entered.", vbOKOnly, "Logon Error"
If Frame19.Value = 1 Then
DoCmd.OpenForm "HelpDeksCalls", , , acPreview
Else
DoCmd.OpenForm "HelpDeskCalls", acNormal, [TicketNumber]
End If
End If
End If
End Sub