Count in combo box

T

Tom

Hi,
I have a form with combo box (combo1)which based on query.
When the form load I would like to count the item in combo1.
If there are no items, the form loading will be canceled and massage "No
items to choose".

Any ideas,

Thanks,
T
 
B

Bill Mosca, MS Access MVP

The simplest way would be to use a DCount() function to check before you
even open the form.

If DCount("CustID", "Orders", "CustID=123")=0 Then
MsgBox "No Data available for selected filter."
Else: DoCmd.OpenForm "myForm"
End If
 
T

Tom

Thanks.
Bill Mosca said:
The simplest way would be to use a DCount() function to check before you
even open the form.

If DCount("CustID", "Orders", "CustID=123")=0 Then
MsgBox "No Data available for selected filter."
Else: DoCmd.OpenForm "myForm"
End If
 
Top