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

I have the code: =DCount("[Prior

Status
Not open for further replies.

gyli84

MIS
Aug 6, 2001
67
GB
I have the code:

=DCount("[Priority]","Calls","[Priority] = '1'")

As the controlsource in a text box to to display the SUM of all the records where the Priority field in a "Calls" table = 1. However I would only like the sum of all the records where the priority field in a calls table = 1 AND a checkbox (let's call it checkbox1 and the field "completed") in the same "Calls" table is FALSE. Does anyone know what extra bit I have to add to the code to achieve this?

Thanks
 
=DCount("[Priority]","Calls","[Priority] = '1' AND [CheckBox]=0")

You may have troubles with the quotes around that 1, if the priority field is text you'll be fine, but if it's a number remove the quotes. For the CheckBox field i'm ASSUMING that you defined a YES/NO field type, if that's the case the code above will work.

HTH Joe Miller
joe.miller@flotech.net
 
While it is true that Access defines -1 as True and 0 as False internally, it is a better practice to use the boolean indicators True or False where needed rather than the integer counterpart. Technically, any value other than 0 is True while only 0 is False.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top