G
Guest
Hi I need some help with comparing a control value to a recordset value.
Was wondering if any of you EVER seen something like this?
This is my code from my form when the subm,it button is clicked
Private Sub cmd_Submit_Click()
On Error GoTo Err_cmd_Submit_Click
Dim rs As New ADODB.Recordset
rs.Open "qryGetAdminInfo", Application.CurrentProject.Connection,
adOpenForwardOnly, adLockReadOnly
If (Not rs.EOF) Then
If (Me!txt_password = rs!AdminPassword) Then
Forms!frmSwitchBoard!cmd_DataMgmt.ForeColor = 0
Forms!frmSwitchBoard!cmd_ReportMgmt.ForeColor = 0
Forms!frmSwitchBoard!cmd_AdminMgmt.ForeColor = 128
Forms!frmSwitchBoard!frmSwitchBoardsub.SourceObject =
"frmSwitchBoardAdminMgmtsub"
DoCmd.Close acForm, Me.Name
Else
MsgBox "Sorry incorrect password", vbExclamation
DoCmd.Close acForm, Me.Name
End If
Else
MsgBox "Was not able to access password", vbCritical + vbOKOnly,
"SQL ERROR"
DoCmd.Close acForm, Me.Name
End If
Exit_cmd_Submit_Click:
On Error Resume Next
If rs.State = adStateOpen Then rs.Close
Exit Sub
Err_cmd_Submit_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description, , Me.Name & _
": cmd_Submit_Click"
Resume Exit_cmd_Submit_Click
End Sub
When debugging this is the information pulled out
?rs!AdminPassword, me!txt_Password
GorgeousOne GORGEOUSONE
?rs!AdminPassword= me!txt_Password
True
Now, this is a password window. Rs is the recordset that returned with the
password from the database. Me!txt_Password is the typed/inputted field in.
It keeps letting me in EVEN though the passwords typed are obviously NOT the
same….As shown with the debug results..
Any help is greatly appreciated.
Angela
Was wondering if any of you EVER seen something like this?
This is my code from my form when the subm,it button is clicked
Private Sub cmd_Submit_Click()
On Error GoTo Err_cmd_Submit_Click
Dim rs As New ADODB.Recordset
rs.Open "qryGetAdminInfo", Application.CurrentProject.Connection,
adOpenForwardOnly, adLockReadOnly
If (Not rs.EOF) Then
If (Me!txt_password = rs!AdminPassword) Then
Forms!frmSwitchBoard!cmd_DataMgmt.ForeColor = 0
Forms!frmSwitchBoard!cmd_ReportMgmt.ForeColor = 0
Forms!frmSwitchBoard!cmd_AdminMgmt.ForeColor = 128
Forms!frmSwitchBoard!frmSwitchBoardsub.SourceObject =
"frmSwitchBoardAdminMgmtsub"
DoCmd.Close acForm, Me.Name
Else
MsgBox "Sorry incorrect password", vbExclamation
DoCmd.Close acForm, Me.Name
End If
Else
MsgBox "Was not able to access password", vbCritical + vbOKOnly,
"SQL ERROR"
DoCmd.Close acForm, Me.Name
End If
Exit_cmd_Submit_Click:
On Error Resume Next
If rs.State = adStateOpen Then rs.Close
Exit Sub
Err_cmd_Submit_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description, , Me.Name & _
": cmd_Submit_Click"
Resume Exit_cmd_Submit_Click
End Sub
When debugging this is the information pulled out
?rs!AdminPassword, me!txt_Password
GorgeousOne GORGEOUSONE
?rs!AdminPassword= me!txt_Password
True
Now, this is a password window. Rs is the recordset that returned with the
password from the database. Me!txt_Password is the typed/inputted field in.
It keeps letting me in EVEN though the passwords typed are obviously NOT the
same….As shown with the debug results..
Any help is greatly appreciated.
Angela