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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If combo box has no data in dropdown, display error message.

Status
Not open for further replies.

r0nniem

Technical User
Dec 22, 2005
28
AU
Hoping you can help me out. I've got a tabbed form with subforms. A couple of the tabs are:

1. Tariff Info
2. Rates Info with Tariff Combo box.

Example of Tarrif Data:
1-MonToFri 08:00 to 16:59
2-MonToFriAH 17:00 to 21:59

In the Rates Info tab, the Tariff combo is linked to the Tariff data. Therefore if Tariff Info no yet entered - no data in the dropdown.

On the OnLoad process, I would like check if the Tariff combo has any data in the dropdown and if not, display an error message saying "Please complete the Tariff Info first".

Hope this is clear enough ...

Thanks
Ronnie
 
How are ya r0nniem . . .

Perhaps this will do:
Code:
[blue]   Dim Msg As String, Style As Integer, Title As String
   
   If Me!CBx1.[purple][b]ListCount[/b][/purple] = 0 Then
      Msg = "Please complete the Tariff Info first!"
      Style = vbInformation + vbOKOnly
      Title = "No Tariff Entry Error! . . ."
      MsgBox Msg, Style, Title
   Else
      [green]'other code here[/green]
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top