View Full Version : checking listbox


kingsgambit
05-01-2002, 03:40 PM
I have a form where a user can select an item from a listbox and press search, it then opens that record. Is there a code to check if the user has selected from the list. If they just press search without selecting from the list I get an error message

boblarson
05-01-2002, 03:46 PM
You could do something like this in your code behind your search button:

If IsNull(lstMyListBoxName) Then
Msgbox "You MUST select an item from the listbox before searching!", vbExclamation, "SEARCH ERROR"
Exit Sub
End If


BL
hth