chanman525
IS-IT--Management
Ok, i have just spent the last couple hours scouring the forum trying to find a resolution to my delima. I am certain that after I post this that someone will probably refer me to a previous post. If so please forgive me as I have searched on many diff sequences to find what I needed.
Now that I have my disclaimer out of the way....
I have a form that is used for password control. But the problem I have is that I can not get it to execute the event when I press the ENTER key. I have the behaviour set to new line (as stated in other posts) and I have tried the Key Press and Key Down subs.
Here is my code;
Right now when I press the ENTER key I get invalid password and I am certain that this is due to the carriage return being sent by the ENTER Key.
Any ideas would be greatly appreciated.
Now that I have my disclaimer out of the way....
I have a form that is used for password control. But the problem I have is that I can not get it to execute the event when I press the ENTER key. I have the behaviour set to new line (as stated in other posts) and I have tried the Key Press and Key Down subs.
Here is my code;
Code:
Private Sub TxtPasswordInput_KeyPress(KeyAscii As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
If (KeyAscii = 13) Then
Select Case Me.TxtPasswordInput
Case "not4u2no"
Forms!frmmain!BtnAssignTask.Enabled = True
Forms!frmmain!BtnOpenConfig.Enabled = True
Forms!frmmain!BtnOpenFrmProjectManager.Enabled = True
Me.TxtPasswordInput.Value = ""
DoCmd.Close acForm, "frmPassword"
Case "project"
DoCmd.Close acForm, "FrmPassWord"
On Error GoTo Err_BtnOpenFrmProjectManager_Click
stDocName = "FrmProjectManager"
stLinkCriteria = "[ID]=" & Forms!frmmain![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
Exit_BtnOpenFrmProjectManager_Click:
Exit Sub
Err_BtnOpenFrmProjectManager_Click:
MsgBox Err.Description & Chr(13) & "Are you on a valid record?"
Resume Exit_BtnOpenFrmProjectManager_Click
Case Else
MsgBox "You entered an invalid password!", vbExclamation, "Invalid Password"
Me.TxtPasswordInput.Value = ""
Me.TxtPasswordInput.SetFocus
End Select
End If
End Sub
Right now when I press the ENTER key I get invalid password and I am certain that this is due to the carriage return being sent by the ENTER Key.
Any ideas would be greatly appreciated.