I have a form with a date field the user completes upon completing the form. I want them to check one of the check boxes in a section on the form before exiting. I cannot put this procedure in the form's BeforeUpdate event because the user must be allowed to edit the form several times prior to finishing with it. I use the code below in the date field BeforeUpdate for this purpose and it works except it will not allow the focus to be set back to the first check box in the section. If I eliminate the err routine this is the error message I get:
Run-time error '2108':
You must save the filed before you execute the GoToControl action, the GoToControl method. or the SetFocus methos.
Private Sub dteDateCompleteQM_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_dteDateCompleteQM
'Force user to check one of the boxes in the Outcome section.
If ynPredictable.Value = False And ynUnpred.Value = False _
And ynMargDeviation.Value = False And ynSigDeviation.Value = False _
And ynNAOutcome.Value = False Then
MsgBox "You must select at least one box in the OUTCOME Section!"
DoCmd.CancelEvent
Me!dteDateCompleteQM.Undo
ynPredictable.SetFocus
End If
Exit_dteDateCompleteQM:
Exit Sub
Err_dteDateCompleteQM:
End Sub
I have used the SetFocus method many times and never received this error.
Any ideas? Thanks
Run-time error '2108':
You must save the filed before you execute the GoToControl action, the GoToControl method. or the SetFocus methos.
Private Sub dteDateCompleteQM_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_dteDateCompleteQM
'Force user to check one of the boxes in the Outcome section.
If ynPredictable.Value = False And ynUnpred.Value = False _
And ynMargDeviation.Value = False And ynSigDeviation.Value = False _
And ynNAOutcome.Value = False Then
MsgBox "You must select at least one box in the OUTCOME Section!"
DoCmd.CancelEvent
Me!dteDateCompleteQM.Undo
ynPredictable.SetFocus
End If
Exit_dteDateCompleteQM:
Exit Sub
Err_dteDateCompleteQM:
End Sub
I have used the SetFocus method many times and never received this error.
Any ideas? Thanks