Code runs out of sequence?

D

David Habercom

I am confused by these procedures because, after there is no match for the
combox and the message shows, execution returns to the first
Me.EndwmtsComBx2.SetFocus. What is happening? Is there a better way to do
this? Help & thank you!

Private Sub SearchNamePart2_Exit(Cancel As Integer)
If SearchNamePart2 > "" Then
Me.EndwmtsComBx2.Visible = True
Me.EndwmtsComBx2.SetFocus '<--Execute returns here.
End If
End Sub

Private Sub EndwmtsComBx2_GotFocus()
'Limit combox to criteria specified in SearchNamePart2.
Me.EndwmtsComBx2.RowSource = "SELECT ...." 'This works fine.
If IsNull(Me.EndwmtsComBx2.Column(0, 0)) = True Then
Call DisplayAlert("No matches for this search.")
Me.SearchNamePart2 = ""
Me.SearchNamePart2.SetFocus
Me.EndwmtsComBx2.Visible = False
Else
Me.EndwmtsComBx2.Dropdown
End If
End Sub
 
Top