Results 1 to 9 of 9
  1. #1
    Sabrin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Location
    Novascotia
    Posts
    4

    How to select multiple values from combobox in query?

    I am trying to make fields to calculate the average of weekdays values and weekend values separately. Field 1 (combobox): Day starts dieting[weekdays(Day starts dieting)], Field 2 (combobox): Observation days (1,2,3,4,5,6,7), Field 3: Weight, Field 4: Duration of excersize time. I am asking my apology if it is really a simple solution.I am totally a new user.



    I am confused how can i simply set it in query. I want to make a query like: IIf [Day starts dieting]=2, Select[ Observation days]=1,2,3,4,5, IIf[Day strats dieting]=2, Select[observation day]=1,2,3,4,7, IIf [Day starts dieting]=3, Select[Observation day]=1,2,3,6,7. I am thinking, if I can select the observation days, then I will get the average values for the weekdays for weight and Duration field.

    Can anyone help me regarding this issue. It will be really appreciated.


    Sabrin

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    I don't understand what you mean by 'Select[Observation days]=' - select from where?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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. #3
    Sabrin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Location
    Novascotia
    Posts
    4
    I have 4 fields in my database

    Date of Start Day of Start Observation day Weight
    (Time/Date) (Weekday([Date of Start)]) (Combobox) (values)
    14-03-15 7 1 52
    14-03-16 1 2 53.1
    14-03-17 2 3 52
    14-03-18 3 4 52.5
    14-03-19 4 5 52.3
    14-03-20 5 6 51
    14-03-21 6 7 50
    Using Field Day of start and Observation day, I want to calculate the weekday average and weekend average for weight. Can anyone help me on this?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Sabrin,

    Readers do not understand what you are asking. It is often helpful if you give us an introduction/overview of your business issue/opportunity. Readers are guessing at the subject matter and the calculation(s) being requested.

    Perhaps you could tell us in plain English WHAT you are doing and measuring. And a sample showing the input, the output and the arithmetic involved. I can assure you that once readers understand, they will give you suggestions, options and/or responses.

    Good luck. How is the snow storm at the moment??

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Should be easy to calculate a week number for every Mon-Sun week period and summarize data by that week number. Filter criteria can include or exclude weekends or weekdays.

    SELECT Year(DateOfStart) & Format(DateOfStart, "ww", 2) AS YrWkNum, Avg(Weight) AS AvgWt WHERE Weekday(DateOfStart, 2)<6 GROUP BY Year(DateOfStart) & Format(DateOfStart, "ww", 2);

    SELECT Year(DateOfStart) & Format(DateOfStart, "ww", 2) AS YrWkNum, Avg(Weight) AS AvgWt WHERE Weekday(DateOfStart, 2)>5 GROUP BY Year(DateOfStart) & Format(DateOfStart, "ww", 2);
    Last edited by June7; 03-27-2014 at 08:12 PM.
    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. #6
    Sabrin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Location
    Novascotia
    Posts
    4
    Hi Orange,

    No more snow storm here!! Today we had a sunny day, but cold!!!

    I am working on a project where I am using actiwatch. This actiwatch will be used for a months by 100 participants. For this project, I am trying to develop a database. Participants ID, Age, Daily activities(excursive, daily meals), daily intake calories, daily weight measures and some others variables are collecting for analysis. For my input variables (daily intake calories, duration of excursive, weight), I want to calculate the weekdays average, weekends average, weekly average, monthly average(Total). I don't know how I can separate the weekdays and weekend to get the weekdays average or weekend average.

    Does it make sense??

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    I just looked up actiwatch on google --had never heard of it.
    I'm going to suggest a tutorial on database design. It will help with tables and relationships. It uses a clear statement of the business and business rules, and leads you to a solution. It does have a solution included.
    I think it will help you define your "business requirements" from a point of knowledge (less guessing).
    Getting the database designed to match the requirement is key.
    Good luck.

    From the Date you can determine the DayOfWeek. You can also identify Saturday and Sunday.
    Tell us more about the issue of weekdays and weekends.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Did suggestion in post 5 help?
    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.

  9. #9
    Sabrin is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Location
    Novascotia
    Posts
    4
    Hi June7,

    Thanks for your suggestion. I have solved my problems. This forum is really helpful.

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

Similar Threads

  1. Replies: 9
    Last Post: 07-24-2013, 02:56 PM
  2. Replies: 2
    Last Post: 04-10-2013, 03:54 PM
  3. Replies: 1
    Last Post: 03-28-2013, 11:10 PM
  4. Replies: 3
    Last Post: 12-16-2011, 02:37 PM
  5. Replies: 3
    Last Post: 01-04-2011, 07:06 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