I am using following code in a text box exit event to find matched text in a list box.
What I need is when exact text is not found, a message box to display and some other actions but I am not finding correct place to keep those else commands. You can see else commands in ' appostophe.
May somebody suggest how to tackle this.
Thanks.
Private Sub txtLoaded_Exit(Cancel As Integer)
Dim I As Integer
If Not IsNull(txtLoaded) Then
For I = 0 To Me.lstLoaded.ListCount - 1
If Left$(Me.lstLoaded.Column(0, I), Len(Me.txtLoaded)) = Me.txtLoaded Then
Me.lstLoaded.Selected(I) = True
Me.lstLoaded.SetFocus
Me.lstLoaded.ListIndex = I
Me.cmdLoad.Enabled = True
Exit For
'Else
' MsgBox "Not available.", vbInformation
' Me.cmdLoad.Enabled = False
End If
Next I
Else
Exit Sub
What I need is when exact text is not found, a message box to display and some other actions but I am not finding correct place to keep those else commands. You can see else commands in ' appostophe.
May somebody suggest how to tackle this.
Thanks.