Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2007

Tip: Looking for answers? Try searching our database.

Count a specific value.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cage4000 - 12 Mar 2007 16:46 GMT
Hi all,

I’m trying to make a text box return a “count” from another field that
contains a specific value.  I want the text box to give me a count of all the
records that contain “2320” but it gives me the count for all the values
instead.

My Expression builder code is =Count([DepPlusSize]="2320")

Can anyone tell me what is wrong with my code?

Thanks,

Cage
Stefan Hoffmann - 12 Mar 2007 16:51 GMT
hi,

> My Expression builder code is =Count([DepPlusSize]="2320")
Try =Sum(Iif([DepPlusSize]="2320";1;0)) in your footer.

mfG
--> stefan <--
Allen Browne - 12 Mar 2007 16:53 GMT
Try:
   = - Sum([DepPlusSize] = "2320")

Omit the quotes if DepPlusSize is a Number field (not a Text field.)

The expression inside the brackets is True or False (or Null) for each
record. Access uses -1 for True, and 0 for False. Therefore summing the
expression gives the negative count of the cases where the expression is
True.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hi all,
>
[quoted text clipped - 11 lines]
>
> Cage
cage4000 - 12 Mar 2007 17:12 GMT
That worked! Thank you Stefan and Allen for your help on this one.

> Try:
>     = - Sum([DepPlusSize] = "2320")
[quoted text clipped - 21 lines]
> >
> > Cage
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.