View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
BigPig BigPig is offline
external usenet poster
 
Posts: 77
Default message box to check value

Toppers,

Thankyou very much! It worked perfectly.

Now I have another question.

How would I get a message box to check through all of the text boxes, combo
boxes, etc to ensure that something was entered? And then display within the
message box what textboxes/comboboxes were left blank?

Thanks again for your help!

"Toppers" wrote:

In your command_click module:
' Assumes combobox1 is "Ethnicity" combo ....
If combobox1.listindex=-1 then <== change combobox1 to suit
Msgbox "Please select ethnicity"
exit sub
end if


HTH
"BigPig" wrote:

How would I get a message box to check if a combobox has something in it,
after a command button is selected?

Example. I have a user form(entry) that draws data from a database
spreadsheet, it populates several textboxes, togglebuttons, and a couple
combo boxes. One of the comboboxes that doesn't get updated is ethnicity,
which the user has to select an ethnicity, of which there are several. At the
bottom of the userform is a command button that will put all of the data that
is in the user form, and place it in a form spreadsheet underneath it.

End state. What I would like to happen is that when the user clicks on the
command button "add data to underlying form", a message box pops up and tells
the user that "you forgot to select an ethnicity", and then stop the macro
associated with the commandbutton "add data to underlying form", if the user
forgot to select an ethnicity from the combobox.

Please help!