Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    126

    Unanswered: Conditional Count in subform

    I was hoping to not start a new thread, but i've not found anything searching here or google.

    I have a sub-form (sourced from a query) that has two fields; Name (source: ItemName) and AuthYear (source: Year). In the footer of the sub-form I have a field that is supposed to count the number of rows that show the current year.

    I tried Count([Year]=Year(Now())) only to learn that Access's count function doesn't work that way. I looked at DCount and used the name of the sub-form for the domain, but that didn't work. I looked for a CountIf equivalent but can't find one.

    Does anyone have a function to do this?

    Pete
    PGT

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I can't remember how this works in forms but you can have expressions in COUNT()
    Code:
    COUNT(Iif([Year]=Year(Now()), 1, NULL))
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Aug 2006
    Posts
    126
    Thanx Pootle,
    I thought I had tried all types of expressions in the Count(expr), including IIF. Somehow I missed (or messed up) something (more likely the latter). Your answer works exactly as required.
    Pete
    PGT

Tags for this Thread

Posting Permissions

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