Summary at report header

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stoic
    New Member
    • Jun 2012
    • 68

    Summary at report header

    I have developed an Access database with report that depends on list of teachers showing their genders (male & female). I would like to include in the report header, a summary dis aggregation of the gender.
    This is what I have but not working:

    =count([strGender]="Male")

    Can anyone assist with this?
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    Stoic,

    I think you should use the DCount function. Syntax would be:

    =DCount("*","Ta bleName","[strGender] = 'Male'")

    That should do the trick.1

    Comment

    • Stoic
      New Member
      • Jun 2012
      • 68

      #3
      Thanks twinnyfo, that did it.

      Comment

      • Stoic
        New Member
        • Jun 2012
        • 68

        #4
        A followup to this. Is it possible to dis aggregate the gender by county or section instead of general record?
        Thanks

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3662

          #5
          You would just adjust the Dcount syntax based on where in the report it falls:

          =DCount("*","Ta bleName","[strGender] = 'Male'" & " AND [strCounty] = '" & [txtCounty] & "' AND [strSection] = '" & [txtSection] & "'")

          You just have to be careful with syntax for strings and numbers. In the example above, the DCount is dependent upon text fields on the form. Play with it to make it suit your purposes exactly.

          Let me know how this works.

          Comment

          • Stoic
            New Member
            • Jun 2012
            • 68

            #6
            Thanks twinnyfo, but this didn't work for what I am wanting to have. My table name is tblTeachersProf ile with the fields strCounty, strDistrict and strGender; and my report have sections that list the schools by county and district. At each county heading, I would like to show the number of male teachers and female teachers. Is that possible?
            Best,

            Comment

            • twinnyfo
              Recognized Expert Moderator Specialist
              • Nov 2011
              • 3662

              #7
              Stoic,

              First, a few notes about Database normalization. I don't know what your tables look like, but I have assumed their mechanics based on your descriptions.

              First, if you have several counties that your teachers can work in, you should have a separate table for counties. Then, your "County" is actually a number, refering to the primary key of that table. The same goes with your districts. When you add a teacher, you should have a form that allows you to select the county and then queries the recordset for the District dropdown based on the county, so that you can only select districts that reside in a particular county. Believe it or not, I would also create a table for Gender, two fields: GenderID, and Gender; and two records: 1, Male; 2, Female.

              I've included my concept in the attachment, which aligns itself with your field names. It shows a very basic report that counts gender over the County Group. If you had a separate Group for each District, you could do this, too, just modify the control source for the Gender text box in each header.

              Hope this info will help!

              Comment

              • Stoic
                New Member
                • Jun 2012
                • 68

                #8
                Sorry twinnyfo, I did not see the attachment you spoke about. That might be very helpful. Please send me the attachment. I am sure I can handle myself with your concept. I do have separate tables for county, district, and even gender except that the gender does not have code attached to it, but the others do.
                Thanks

                Comment

                • twinnyfo
                  Recognized Expert Moderator Specialist
                  • Nov 2011
                  • 3662

                  #9
                  Not sure why this did not attach last time......
                  Attached Files

                  Comment

                  Working...