G
Guest
I am attempting to require users to enter data into a specific combo box
before they can fill out the rest of my form. My unbound combo box selects a
record from a member database and is at tab stop 0 so it has the focus when
the form is opened. If users neglect to either enter a member id or select
one from the list in the combo box I want to display a message and return the
focus, and the cursor, to the correct place. I have tried using OnExit and
OnLostFocus and the MsgBox pops up but the focus changes to Tab 1 when what I
want is to stay put. It seems like what I need is a BeforeExit property but
no joy on that score
Private Sub cboSelectMember_LostFocus()
If IsNull(Me.cboSelectMember) Then
MsgBox "You must select a member number"
Me.cboSelectMember.SetFocus
End If
End Sub
before they can fill out the rest of my form. My unbound combo box selects a
record from a member database and is at tab stop 0 so it has the focus when
the form is opened. If users neglect to either enter a member id or select
one from the list in the combo box I want to display a message and return the
focus, and the cursor, to the correct place. I have tried using OnExit and
OnLostFocus and the MsgBox pops up but the focus changes to Tab 1 when what I
want is to stay put. It seems like what I need is a BeforeExit property but
no joy on that score
Private Sub cboSelectMember_LostFocus()
If IsNull(Me.cboSelectMember) Then
MsgBox "You must select a member number"
Me.cboSelectMember.SetFocus
End If
End Sub