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!

If no data found-return message in form

Status
Not open for further replies.

trialerror

Programmer
Aug 18, 2003
15
US
I have 2 combo boxes on my form. Based on what I select in the first one, the second one is populated using an underlying query. But what if there is nothing matching the selection in the first-I would like to have a message displaying like "No data found" etc.
Thanks for all your help.
 
Use the controls Listcount property to count items in the combo after you have populated it.
 
What do I do with it- which event do I link it with ? Thanks
 
Hi
How about using the On Change event of combo box #1?
If ComboBox2.Listcount=0 Then
MsgBox "No data"
End if
 
Great-this works but does not "refesh " itself, if I go back in the form and it already has the selections in the first combo box, it does not display the message again unless I click the first combo box again. Thanks
 
Well then the form current event, maybe?
 
If your code is such that you say Combo2.Requery in the Combo1.Click event, you can then follow with the code Remou gave. I am presuming you are clicking Combo1 to fill Combo2?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top