PC Review


Reply
Thread Tools Rate Thread

Count in combo box

 
 
Tom
Guest
Posts: n/a
 
      24th May 2007
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


 
Reply With Quote
 
 
 
 
Bill Mosca, MS Access MVP
Guest
Posts: n/a
 
      24th May 2007
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

--
Bill Mosca, MS Access MVP
http://tech.groups.yahoo.com/group/M..._Professionals


"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      24th May 2007
Thanks.
"Bill Mosca, MS Access MVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> --
> Bill Mosca, MS Access MVP
> http://tech.groups.yahoo.com/group/M..._Professionals
>
>
> "Tom" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
way to count object in combo box using between dates Heygrippet Microsoft Access External Data 1 13th Jan 2009 06:42 AM
combo box count =?Utf-8?B?Sm9zZSBNLg==?= Microsoft Excel Misc 1 28th Oct 2006 12:43 AM
combo box count =?Utf-8?B?Sm9zZSBNLg==?= Microsoft Excel Misc 0 27th Oct 2006 05:08 PM
Count value in combo box if = to ... =?Utf-8?B?TWljaGFlbCBTLg==?= Microsoft Access Reports 2 31st May 2006 04:33 PM
How do I use a query to count records in a combo box? =?Utf-8?B?QmVuTmVlZEhlbHA=?= Microsoft Access Queries 1 22nd May 2006 08:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 AM.