Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: Calculating Percentages in Query

    This is probably blindingly obvious but i just cant remember or find how to do it.

    I've got a query in Access97 which is looking up a variety of data from a table, what i want to be able to do is:

    a) Count how many query results are returned and be able to pull this figure into a report running off the query

    b) I've got a number of fields based on yes/no answers - i want to be able to get a percentage of yes and percentage of no and again pull this onto a report...

    Appreciate any help, being really dim due to no Db work in last 4 years or so...

    Steve

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Calculating Percentages in Query

    Originally posted by stek2003
    This is probably blindingly obvious but i just cant remember or find how to do it.

    I've got a query in Access97 which is looking up a variety of data from a table, what i want to be able to do is:

    a) Count how many query results are returned and be able to pull this figure into a report running off the query

    b) I've got a number of fields based on yes/no answers - i want to be able to get a percentage of yes and percentage of no and again pull this onto a report...

    Appreciate any help, being really dim due to no Db work in last 4 years or so...

    Steve
    For your Yes/No's: Add a textbox on the report in the detail section (hidden) that has the following ControlSource:

    = IIf([CheckBoxNameHere]=True,1,0)

    One to test for Yes and one to test for No ...

    As for your count:

    You could do this: Adda textbox somewhere (preferably in the Report Header or Footer) and make this the controlsource:

    =DCount("QueryNameHere")

  3. #3
    Join Date
    Mar 2004
    Posts
    5
    Thanks for this - probably me being dim but the count one isn't working, i've entered the control source as:

    =DCount("poorbyteamdate")

    (poorbyteamdate is name of the query)

    I get a error of "The expression you entered has a function containing the wrong number of arguments"...
    Any thoughts on where im failing?

    And with the percentage of yes/no's all i get reported back seems to be a 1 - is this right?

    Again, sorry for being so dim and really appreciate your help,

    Steve

Posting Permissions

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