Results 1 to 5 of 5
  1. #1
    tedstriker is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    2

    Query issue

    Hello,

    I need to create a query that has me stumped. I have a single table of data containing hotel room types, arrival dates and departure dates. Their are 3 types of rooms, Ocean view, side view, and dining view. I need to create a query to display the average length of stay per room type. I'm lost on how to solve this one. Any ideas? Thanks in advance, I look forward to your replies.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Have you tried building a query object using the Query Builder? Perhaps the Avg() function with an alias is the solution. Check out the Totals option within the ribbon while in Design View of your query object.

  3. #3
    tedstriker is offline Novice
    Windows 8 Access 2013
    Join Date
    Jul 2014
    Posts
    2
    I have, but I'm really confused as to how to differentiate between the different room types within the same column. How to I get the average for just one type of room?

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If you are including the room type in your query and the avg is averaging all three types together, you will need to have three different queries then. Another approach may be to use Grouping in a report. You can group the room types there and use an expression in the Group Footer, employing the Avg() function in your unbound text box.

    EDIT:
    I just did a quick test and I am not sure where it is you are having trouble. Take a look at Query1 here.
    Attached Files Attached Files

  5. #5
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    create "Query1" that has fields: hotel room types & length stay (departure minus arrival)

    then create "Query 2" and drag onto it Query 1 as its record set table; then make Query 2 into an aggregate query by pressing the sigma symbol (looks sort of like an E) - - this will default to 'group by' for both fields ; leave the room type as group by but change the length stay to be Average...


    it is actually quite easy....

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

Similar Threads

  1. Query issue
    By mashtha9 in forum Access
    Replies: 1
    Last Post: 06-07-2014, 07:05 AM
  2. Query issue
    By BRZ-Ryan in forum Queries
    Replies: 12
    Last Post: 01-14-2014, 03:23 PM
  3. Issue with time query
    By Reynardine in forum Queries
    Replies: 2
    Last Post: 09-23-2012, 08:49 AM
  4. Query Issue
    By mtnairco in forum Access
    Replies: 4
    Last Post: 07-22-2011, 10:46 AM
  5. Query Issue
    By access in forum Queries
    Replies: 1
    Last Post: 01-14-2010, 03:28 PM

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