Full Version: command button message if list box on form has nothing selected
UtterAccess Forums > Microsoft® Access > Access Forms
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!
try this...

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

That works great. Thanks very much Trapper!
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.