Hello,
I want to enforce a minimum string length in a search. The following code gives the messagebox when the text box txtNameSearch is empty, but proceeds to fill the listbox with results if the text box has one or more characters in it.
Is there some special issue with asterisks in this context?
I want to enforce a minimum string length in a search. The following code gives the messagebox when the text box txtNameSearch is empty, but proceeds to fill the listbox with results if the text box has one or more characters in it.
Is there some special issue with asterisks in this context?
Code:
strName = Chr(34) & "*" & txtNameSearch & "*" & Chr(34)
If Len(strName) < 5 Then
Dim intMsgBoxResult As Integer
intMsgBoxResult = MsgBox("Enter 3 or more letters of the name", vbOKOnly + vbExclamation, "Need More Letters!")
Else
'create a record set and put it in a listbox