G
Guest
I need help with an iff statement on my form. Basically I have a new record
when the "Insert" key is pressed. But I want to stay with the current
record if [TotalHrs] is greater or less than IDRb_subform.Form!SumHours.
Otherwise a new record is called for. I think I'm close here but a little
help would be appreciated. Thanks, Randy
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo ErrRoutine
Select Case KeyCode
Case vbKeyInsert
If [TotalHrs] > 0 Then
If IDRb_subform.Form!SumHours <> [TotalHrs] Then
If MsgBox("Total Hours for Applicants to not agree with Total
Hours", vbYes + vbDefaultButton2) <> vbYes Then
Me.Form![TotalHrs].SetFocus
'Case Else
'End Select
Else
End If
End If
End If
Select Case KeyCode
Case vbKeyInsert
DoCmd.GoToRecord , , acNewRec
Case Else
End Select
ErrRoutine:
If Err.Number = 2105 Then
Resume Next
End If
End Select
End Sub
when the "Insert" key is pressed. But I want to stay with the current
record if [TotalHrs] is greater or less than IDRb_subform.Form!SumHours.
Otherwise a new record is called for. I think I'm close here but a little
help would be appreciated. Thanks, Randy
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo ErrRoutine
Select Case KeyCode
Case vbKeyInsert
If [TotalHrs] > 0 Then
If IDRb_subform.Form!SumHours <> [TotalHrs] Then
If MsgBox("Total Hours for Applicants to not agree with Total
Hours", vbYes + vbDefaultButton2) <> vbYes Then
Me.Form![TotalHrs].SetFocus
'Case Else
'End Select
Else
End If
End If
End If
Select Case KeyCode
Case vbKeyInsert
DoCmd.GoToRecord , , acNewRec
Case Else
End Select
ErrRoutine:
If Err.Number = 2105 Then
Resume Next
End If
End Select
End Sub