lawsonbooth
12-13-2006, 08:23 AM
How do you test for when a person has not selected any item in a listbox?
I have a listbox on a userform with two command buttons, one for submit and one for cancel. I am trying to check for the situation when a user fails to select a listbox item, but presses the submit instead of the cancel button. I have tested the following ways and all fail:
If userform1.listbox1.value = vbNull then
.Error code?
End if
If userform1.listbox1.value = ?? or _
userform1.listbox1.value = ? ? then
?error code?
End if
If isNull(userform1.listbox1.value) then
?error code?
End if
If isEmpty(userform1.listbox1.value) then
?error code?
End if
If isblank(userform1.listbox1.value) then
?error code?
End if
There must be a trick I do not know in my limited knowledge. Any help would be greatly appreciated.
Lawson:banghead:
I have a listbox on a userform with two command buttons, one for submit and one for cancel. I am trying to check for the situation when a user fails to select a listbox item, but presses the submit instead of the cancel button. I have tested the following ways and all fail:
If userform1.listbox1.value = vbNull then
.Error code?
End if
If userform1.listbox1.value = ?? or _
userform1.listbox1.value = ? ? then
?error code?
End if
If isNull(userform1.listbox1.value) then
?error code?
End if
If isEmpty(userform1.listbox1.value) then
?error code?
End if
If isblank(userform1.listbox1.value) then
?error code?
End if
There must be a trick I do not know in my limited knowledge. Any help would be greatly appreciated.
Lawson:banghead: