Solved

access Dcount of yes no field

Posted on 2010-08-15
4
460 Views
Last Modified: 2013-11-28
I have a form in a datasheet view.  I have a few txt fields where I use the Dsum function to show me totals on the form.  Ex: for the Finish column I use:

=DSum("[DrFin]","DoorTagLog","[BatchID] = " & [ID])
This sums up the values in the table DoorTagLog for the DrFin so I can see it in the Main form which is bound to the Main JobsDoor table.

I have a field in the DoorTagLog table that is a yes/no field called DrTagShip.  I have a txt field on my main form called "To Ship".

The ToShip =  number of finished doors - shipped doors.

I have the number of finished doors = DSum("[DrFin]","DoorTagLog","[BatchID] = " & [ID])

I am having a hard time getting the Dcount working to figure out how many doors have shipped. Here is what I have tried so far:

=DCOUNT("[DrTagShip]","DoorTagLog","[BatchID] = " & [ID] and "[DrTagShip] = '-1'")

It returns the same value in each row of the datasheet = 1699  -  I am trying to count the nunber of yes values for each Job.

Any suggestions?

Thanks for your help.

0
Comment
Question by:johnmadigan
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 33441059
=DCOUNT("[DrTagShip]","DoorTagLog","[BatchID] = " & [ID] & " and [DrTagShip] = True")
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 33441079
see the difference from your dcount

=DCOUNT("[DrTagShip]","DoorTagLog","[BatchID] = " & [ID] and "[DrTagShip] = '-1'")

revised dcount

=DCOUNT("[DrTagShip]","DoorTagLog","[BatchID] = " & [ID] & " and [DrTagShip] = -1")

0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33441114
johnmadigan,Just for reference, internally Access stores boolean True as -1.  Thus, [DrTagShip] = True and [DrTagShip] = -1 are equvalent tests.:)Patrick
0
 

Author Closing Comment

by:johnmadigan
ID: 33441121
Thanks - I knew I was missing something with the syntax - I love a quick fix.

I am usind the Dsum in the txt field of the datasheet - any advantages to  using a subquery in the main form query to do the same thing?

thanks again for the help.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question