checking listbox

kingsgambit

Registered User.
Local time
Today, 04:54
Joined
May 27, 2001
Messages
134
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
 
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
 

Users who are viewing this thread

Back
Top Bottom