On Lost Focus

  • Thread starter Thread starter Paul Hammond
  • Start date Start date
P

Paul Hammond

I need to require the user to select a value from a
dropdown before taking any other actions. My solution
was to make this control the first tab stop, then add the
follow code to the On Lost Focus event.

Private Sub cboPublication_LostFocus()
If IsNull(Me.cboPublication) Or
Me.cboPublication = "" Then
MsgBox "Please select a publication
from the dropdown box."
Me.cboPublication.SetFocus
End If
End Sub

The problem is that SetFocus action does not take
place. After clearing the message box, whatever control
they click on or tab to gets the focus. Does anybody
know why this doesn't work?

TIA

Paul Hammond
Richmond VA
 
Try using the cbo_Exit Event instead. The Exit Event happens before the
LostFocus Event and it can also be cancelled which means that the Focus
remains on the ComboBox.

Check Access Help on the Exit Event of a ComboBox Control.
 
Thanks, that worked.

Paul
-----Original Message-----
Try using the cbo_Exit Event instead. The Exit Event happens before the
LostFocus Event and it can also be cancelled which means that the Focus
remains on the ComboBox.

Check Access Help on the Exit Event of a ComboBox Control.

--
HTH
Van T. Dinh
MVP (Access)





.
 
Back
Top