P
Peter Mollica
how do I force an error to occur? for example...in
the "lost focus" event for a text box I have some VBA
code that inspects the value. What I want to happen is
to be able to display a msgbox and return control to the
text box in error cancelling any subsequent actions
access would have done. If I was saving the record, I
want access to display the message, go to the text box
and stop, not saving the record.
What I have is...
If Weekday(week_ending) = vbSaturday Then
Else
MsgBox ("Week Ending Must be a Saturday!")
DoCmd.GoToControl "week_ending"
End If
The code executes perfectly but if I change the value of
the text box (week_ending) and "tab" to the next field it
does display the msgbox but it does not go to the
week_ending text box, the cursor goes to the field that
was next in the tab list, I assume because I hit
the "tab" button. How do I interrupt executions and
redirect focus?
the "lost focus" event for a text box I have some VBA
code that inspects the value. What I want to happen is
to be able to display a msgbox and return control to the
text box in error cancelling any subsequent actions
access would have done. If I was saving the record, I
want access to display the message, go to the text box
and stop, not saving the record.
What I have is...
If Weekday(week_ending) = vbSaturday Then
Else
MsgBox ("Week Ending Must be a Saturday!")
DoCmd.GoToControl "week_ending"
End If
The code executes perfectly but if I change the value of
the text box (week_ending) and "tab" to the next field it
does display the msgbox but it does not go to the
week_ending text box, the cursor goes to the field that
was next in the tab list, I assume because I hit
the "tab" button. How do I interrupt executions and
redirect focus?