SetFocus Error on a Conditionally Required Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that is completed by different people at different stages of
the trouble-shooting process. I want to ensure that certain controls are not
left blank.

I have set requirements in the form's Before Update event for the initial
users of the form, using If ElseIf statements that display a message and then
set the focus to the empty control. This is working fine.

Now I'm trying to set up a control to be required by the second users of the
form. I am doing this in a control's Before Update event (rather than the
form's event, since I don't want the first user to get this message). The
MsgBox works fine, but I get an error related to the SetFocus method. It says
something like: You must first save the field before using the ...SetFocus
method.

Here's my statement:
If IsNull(Me![cboSolution]) Then
MsgBox "Please select a solution first."
Me![cboSolution].SetFocus
End If--

When I take out the SetFocus line, the message box appears as I want it to.
I guess this is not a big deal, but I like setting the focus to the empty
control for user convenience. Does anyone have any ideas?
susan
 
Susan,

Which control's Before Update event are you using to run this code?
Presumably not the cboSolution control? Try it on the After Update event.
 
Back
Top