T
Tina Hudson
I have the following code on the On Key Down event but it doesn't work on a
particular form. It works for all other forms that have it. The form which
it doesn't work on has a cbo field as the first field, but even if I skip
over that and enter a date in the next field, the code doesn't work.
Here's the code to disable the escape key:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'This will turn the escape key off
If KeyCode = vbKeyEscape Then
KeyCode = 0
End If
End Sub
I also have code to add my own error message if the first field (the cbo
box) doesn't have data in it. Could this be messing everything up?
Here's the code to show my own error message:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 3314
MsgBox "You must enter whether TDM was held before you can save the
record."
Response = acDataErrContinue
Case Else
Response = acDataErrDisplay
End Select
End Sub
Finally, I have additional code that pushes a value to the form when it
loads. I don't know how to do OpenArgs because I don't understand it, but
the code I have works for me. I don't mind a lesson if you have time.
I don't see anything else that I have in the coding behind the form that
might interfere with the KeyDown event.
Here's the code that should probably be OpenArgs:
Private Sub Form_Load()
Forms!frmQuickAdd_TDM!Family_ID = Forms!frmQuickAdd_TDM!FamilyIdFromForm
End Sub
Thanks,
Tina Hudson
particular form. It works for all other forms that have it. The form which
it doesn't work on has a cbo field as the first field, but even if I skip
over that and enter a date in the next field, the code doesn't work.
Here's the code to disable the escape key:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'This will turn the escape key off
If KeyCode = vbKeyEscape Then
KeyCode = 0
End If
End Sub
I also have code to add my own error message if the first field (the cbo
box) doesn't have data in it. Could this be messing everything up?
Here's the code to show my own error message:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 3314
MsgBox "You must enter whether TDM was held before you can save the
record."
Response = acDataErrContinue
Case Else
Response = acDataErrDisplay
End Select
End Sub
Finally, I have additional code that pushes a value to the form when it
loads. I don't know how to do OpenArgs because I don't understand it, but
the code I have works for me. I don't mind a lesson if you have time.
I don't see anything else that I have in the coding behind the form that
might interfere with the KeyDown event.
Here's the code that should probably be OpenArgs:
Private Sub Form_Load()
Forms!frmQuickAdd_TDM!Family_ID = Forms!frmQuickAdd_TDM!FamilyIdFromForm
End Sub
Thanks,
Tina Hudson