Results 1 to 4 of 4
  1. #1
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286

    Help with putting QUERY in a Range

    Hello i have a query that spits out this (image attached)




    how do i make it so that if the duration is between 1-5, then turn that number into a "5" and the values "number of sites" on the second column should all add together.

    for example if 'Duration' values are 1,2,3, (as in pic), then combine the rows and turn duration into a "5". the number of sites it corresponds to should be 59+18+11, spitting out "88". so the row should now read "5" for Duration" and "88" for number of sites. I want to do this in counts of fives, so Duration can only be 5,10, or 15

    let me know if i need to be more clear. thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try a calculated field:

    GroupOnMe: Switch(Duration <=5, 5, Duration <=10, 10, Duration >10, 15)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    taimysho0 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Nov 2011
    Posts
    286
    hi, i tried your method but am getting an error: pic attached

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Not an error, it is an input parameter prompt. Access can't find a field in source data called Duration so it treats the reference as a prompt. The expression you use to calculation Duration must be repeated in the GroupOnMe field expression.
    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: 3
    Last Post: 07-13-2011, 08:01 AM
  2. Replies: 2
    Last Post: 11-25-2010, 11:01 AM
  3. Putting an Expression in a Field Box
    By MWB in forum Queries
    Replies: 4
    Last Post: 11-02-2010, 06:58 AM
  4. Replies: 0
    Last Post: 07-14-2010, 04:01 PM
  5. Putting a Finished Database up on the Network
    By Imgsolutions in forum Access
    Replies: 1
    Last Post: 07-14-2010, 03:56 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