[mso] Re: Counting records in Access with an IF statement

  • From: "Jim Pettit" <j_e_pettit@xxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Fri, 20 Aug 2004 08:05:58 -0700

Michael--

You can use a domain aggregate function. In the ControlSource of the unbound
text box, place the following:

=DCount("[FIRST]","[tblYourTable]","[FIRST]='MICHAEL'")

Domain aggregate functions are great for rolling up all sorts of data, but
you should know that they're not terribly fast.

--Jim 

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf
Of michael.crader@xxxxxx
Sent: Friday, August 20, 2004 4:17 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Counting records in Access with an IF statement

Dear all,
I have a table and a field called first. I have a form with an unbound
text box. In the properties section, Control Source, I have this code
that counts the records in the field FIRST. This works perfectly.

=Count([first])

Now, what I'd like to do please, is to count the records based on a
criteria, such as MICHAEL

How would the code look - in Excel I'd use a COUNTIF? I was hoping it
was as simple as 

=count([first])="Michael", but this errors.

Many thanks,


> Regards,
> 
> Michael Crader
> 

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes)
in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: