SetFocus

  • Thread starter Thread starter Fion
  • Start date Start date
F

Fion

Hi,

I'm having problem in SetFocus function. I use SetFocus in
a Combo Box. When users click "exit" button, if this Combo
Box field is blank, I want to set back the focus. But now,
the SetFocus function is not functioning and the system
allowed users to exit from the form.

Please advise.

Thanks & regards,
Fion
 
The only way to catch all the possible things that can trigger the saving of
a record in the form is to use the BeforeUpdate event of the Form (not that
of the controls).

The Event Procedure will be something like this:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.[Combo1]) Then
Cancel = True
MsgBox "Fill in the combo, or press <Esc> to undo."
End If
End Sub
 
Back
Top