focus not being set correctly
Hi,
Can someone help me with the following focus problem? There are three dates on the form - entry, target, and completed. The on exit event procedure below doesn't reset the focus to the target date field. The focus goes to the next field (completed). If the set focus line is changed to point to the entry date field (ie: Me.EntryDate.SetFocus) then the focus goes to the entry date.
When there's a problem, I'd like the focus to go back to the problem field. Any suggestions ?
Thanks,
Marty
Private Sub TargetDate_Exit(Cancel As Integer)
If (Me![TargetDate] - Me![EntryDate]) < 0 Then
MsgBox "The Target Date (" & Me![TargetDate] & ") Can Not Be Earlier Than The Entry Date (" & Me![EntryDate] & ")"
Me.TargetDate.SetFocus
Exit Sub
End If
End Sub
|