Results 1 to 2 of 2
  1. #1
    jyellis is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    20

    Report with Age groups data under each group

    I need my report to look like this:
    Under 29 30-39 40-49 Over 50
    11:30 10:29 11:00 10:01
    10:09 10:01 10:33 9:45
    9:45 9:50 10:01 9:01
    8:45 8:52 9:44 8:41


    Then either on top or bottom of report I need the average time by each age group and overall average time.
    Avg time for: Under 29 30-39 40-49 Over 50 By Dept
    avg(time) avg(time) avg(time) avg(time) overall avg

    My query has 2 tables:

    TblTime
    KeyNumber
    Time
    Evaluation Date

    TblProfiile
    KeyNumber
    Fname
    Lanme
    DOB


    Gender

    I created a query from those two tables to give me:
    qryAge
    Time
    Age

    But I am stuck on how to create the report.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Is your Time field a text? Is that elapsed time value? Is that hours and minutes? Will it always be less than 24 hours?

    Can't sum or average elapsed time in the HH:MM:SS form, must convert to decimal days or decimal hours or decimal minutes, so 9:45 is 9.75.

    Assuming yes to the above questions, calculate decimal hours in your query:

    DecHours: Val([Time]) + Val(Mid([Time],InStr([Time],":")+1))

    Calculate the age group:

    AgeGroup: Switch([Age]<30,"30 & Under", [Age]<40,"30 - 39", [Age]<50,"40 - 49", [Age]>49,"50 & Over")

    Now try a CROSSTAB query.

    Alternative to CROSSTAB - calculate each group field with:

    [30 & Under]: IIf([Age]<30, [DecHours], Null)

    [30 - 39]: IIf([Age]>29 AND [Age]<40, [DecHours], Null)

    [40 - 49]: IIf([Age]>39 AND [Age]<50, [DecHours], Null)

    [50 & Over]: IIf([Age]>49, [DecHours], Null)

    Use report Grouping & Sorting and summary calcs in footers.
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 02-25-2013, 04:43 PM
  2. Replies: 2
    Last Post: 06-21-2012, 07:40 PM
  3. Report Groups and Sort
    By cbrsix in forum Reports
    Replies: 4
    Last Post: 11-18-2011, 02:06 PM
  4. Option Groups and Adding Data to Tables
    By ipitydafool in forum Forms
    Replies: 5
    Last Post: 05-02-2011, 01:59 PM
  5. Group & Reports (more than 4 Groups??)
    By JohnS in forum Reports
    Replies: 3
    Last Post: 10-01-2009, 07:11 AM

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
  •  
Other Forums: Microsoft Office Forums