Page 3 of 3 FirstFirst 123
Results 31 to 37 of 37
  1. #31
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32
    Please ignore that last post.



    I have since played around some more and got much further.

    I think one last obstacle to overcome and then I can leave you in peace.

    I've attached the front end to this post.

    Please could you look at it and see how I would do the following.

    rptPPTestProgress is the name of the report with all of these fields on. The control source is qryAggregateJoin.

    Most of the fields on there seem to be working correctly, and performing the correct count.

    I have 2 on there that I can't get to count though.

    These are next to the labels:
    Number Failed
    Number Passed.

    What I want here is the number of records in tblPatchApplication where the Result = Passed/Failed, but still within [Enter PP] criteria.

    Please could you help me with hopefully this last bit?

    Thanks again.
    Attached Files Attached Files

  2. #32
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,897
    None of this data has been filtered by PP. If you need to filter by PP then need to apply filter in each aggregate query.

    qryApplicationAggregate

    SELECT Count(tblPatchApplication.PA_ID) AS CountOfPA_ID, tblPatchApplication.Patch_No, Count(tblPatchApplication.Result) AS CountOfResult, Sum(IIf([Result]="Failed",1,0)) AS FailCount, Sum(IIf([Result]="Passed",1,0)) AS PassCount
    FROM tblPatch INNER JOIN tblPatchApplication ON tblPatch.PatchNo = tblPatchApplication.Patch_No
    WHERE (((tblPatch.PP_ID)=[Enter PP]))
    GROUP BY tblPatchApplication.Patch_No;

    Or summarize by PP_ID and Patch_No:

    SELECT Count(tblPatchApplication.PA_ID) AS CountOfPA_ID, tblPatch.PP_ID, tblPatchApplication.Patch_No, Count(tblPatchApplication.Result) AS CountOfResult, Sum(IIf([Result]="Failed",1,0)) AS FailCount, Sum(IIf([Result]="Passed",1,0)) AS PassCount
    FROM tblPatch INNER JOIN tblPatchApplication ON tblPatch.PatchNo = tblPatchApplication.Patch_No
    GROUP BY tblPatch.PP_ID, tblPatchApplication.Patch_No;

    Do the same compound grouping for Risk. Then join these two queries on tblPatch but the linking must be on both fields (compound key join). Now apply filter [Enter PP].
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #33
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32
    Thank you so much, I think that has done it.

    Really appreciate all the help you've given me!

  4. #34
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32
    Just a quick query, that I didn't think was worth raising a new issue.

    I have an object on my report (the main summary), and this is the control source:

    =Sum([qryPPSummary]![CountOfRiskID])

    If no risks have been entered at all, instead of returning a 0, it is blank.

    How can I get it to return 0 instead of blank?

  5. #35
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,897
    Try Nz function.

    =Nz(Sum([qryPPSummary]![CountOfRiskID]),0)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #36
    CS_10 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Location
    Derbyshire, UK
    Posts
    32
    Thanks very much for that. Seems to have done the trick.

    I am using two of the fields that I have used this Nz function in to work out a percentage, now that returns #Num!

    My expression is =[Text43]/[Text29]

    Both of the text fields used above are in the same format as the control source you provided in the above post.

    Anyway I can prevent #Num! appearing?

  7. #37
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,897
    Do you mean controls instead of fields?

    That might be division by zero error.

    Instead of returning zero if null, return 1 for the divisor.

    Nz([fieldname],1)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Percentage Validation
    By abusaif in forum Access
    Replies: 9
    Last Post: 11-29-2013, 10:25 PM
  2. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  3. Calculating a Percentage
    By Alaska1 in forum Access
    Replies: 7
    Last Post: 12-13-2010, 05:57 PM
  4. Percentage Calculation in a Query
    By Lynn in forum Queries
    Replies: 1
    Last Post: 07-16-2010, 11:23 PM
  5. percentage in a query
    By Peljo in forum Access
    Replies: 2
    Last Post: 02-27-2008, 10:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums