Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enforce selection from a combo box 1

Status
Not open for further replies.

ruzi55

Programmer
Jul 6, 2004
8
GB
I have a combo box on my form, it is populated from a table holding meeting venues and descriptions. On selection of a meeting the selected data from the combo box populates text boxes with in the form, these ultimately, with other info, populate an access table.

I need to be able to post a message it there has been no selection made from the combo drop down list.

On entering the combo box the display is blank - on change (I have tried on exit also) the data is moved to the text boxes. I need to be able to check the state of the display on exit or lost focus from the combo box and if blank send up a message "Selection must be made.."

I have tried many variations:

setting up invisible text box, initial value "" on exit combo box move combo.column(1) to text box, if text box = "" then message - this does not work.

on exit/lost focus of combo box , if combo.column(1)is null then message - this does not work

I have been through the site and tried all the combinations I can think of - it must be something very simple? but how - would appreciate help as I have spent half a day already and feel as if I am going round in circles.

Thanks in anticipation....
 
Have you tested the ListIndex property of the combo ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I don't know what you mean - I am unable to see a ListIndex property for the combo box?????????????
 
I am unable to see a ListIndex property for the combo box
Where are you looking ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Is it updating a table?

If yes, how about code in teh before update event of the FORM to say something like

If Len(Trim(Nz(MyCombo,"")&"")) = 0 Then
msgbox "..."
Cancel = True
End if

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thank you Ken - it worked perfectly! It is now filed in my "how to" book I am compiling
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top