Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Sep 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Counting unique field data in a subform footer (20

    I am using the COUNT function in the footer section of a subForm to calculate the number of classes that a faculty member has taught, e.g., ClassesCalculated =Count('CourseTerm'), where CourseTerm is a numeric code for a specific academic term.
    This works fine, but now I need to count unique CourseTerms in order to determine the number of semesters taught, eliminating duplicate CourseTerms.
    Is there a technique for doing this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Counting unique field data in a subform footer (20

    You could use my extension of <!profile=MarkD>MarkD<!/profile>'s CountUniqueRecords function from <post:=205,329>post 205,329</post:>. The strCnd argument should correspond to the condition that links the subform to the main form.

  3. #3
    New Lounger
    Join Date
    Sep 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Counting unique field data in a subform footer

    Thank you, Hans. I understand how to place the VB code into a module and most of the function. However, I don't understand about how to make the strCnd argument correspond to the condition that links the subform to the main form. Where to I find that information in the Properties sheet?
    When I implement the function in the footer, it appears to give me a unique count of the field from the entire table, instead of the unique count of what's displayed in the subform.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Counting unique field data in a subform footer

    The LinkMasterFields and LinkChildFields properties of the subreport control on the main report specify how the subreport is linked to the main report. Let's say that the LinkChildFields property contains ChildField and that the LinkMasterFields property contains MasterField. If they are number fields, strCnd would look like

    "[ChildField]=" & [MasterField]

    If they are text fields, it would look like

    "[ChildField]=" & Chr(34) & [MasterField] & Chr(34)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •