Full Version: command button message if list box on form has nothing selected
UtterAccess Forums > Microsoft® Access > Access Forms
kevinlaw
Hello UA,
I've got a form in single view that has a list box ("ListNames"). There's a command button on the form that runs some action queries based on what is selected in the "ListNames" list box. I need to put up a message and cancel the run queries code in the command button if the user has not selected anything in the "ListNames" list box. Does anyone know the right code to check if a record is selected for a list box? Many thanks!
trapperalexander
try this...
CODE

if isnull(me.listNames) then
msgbox "Name not selected"
else
'your code here
end if

HTH
kevinlaw
That works great. Thanks very much Trapper!
trapperalexander
welcome, glad to assist. Good luck with your project!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.