Results 1 to 6 of 6
  1. #1
    Kat2016 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    14

    Creating calculated field from parameter results in query

    I am attempting to create a query that will be able to calculate the average amount earned within a set amount of days.



    The amount of days this average would be based on depends on what the user will enter into the parameters.

    The activity_date is my field where the parameters are set, and the net_sales is the amount I will be averaging from the days chosen.

    Is there a way I can create a calculated field that is based on parameter results?

    Would really appreciate the help.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Yes, if the parameter in the query is [Enter Days]
    then just ad this param into the calc:

    example:
    MyCalc: sum([Enter Days])*301/[Enter Days]

  3. #3
    Kat2016 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    14
    The parameter is: between [Start Date] and [End Date]

    I'm very new to this. Why would I be multiplying by 301?

  4. #4
    Kat2016 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    14
    Since I am using between would it be entered into the calculation differently?

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    301 that was an example.

    I would use a form, Let the user enter start date ,end date in the boxes. txtStartDate, txtEndDate.
    A 3rd box txtDays would calc days. txtDays.rowsource = DateDiff("d",txtStartDate,txtEndDate)

    now the query only has 1 param in the calc.
    select *,Count([id])/forms!frmRpt!txtDays AS AVG from table where [date] between forms!frmRpt!txtStartDate and forms!frmRpt!txtEndDate

  6. #6
    Kat2016 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    14
    Thank you for your help.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-28-2013, 09:13 AM
  2. Help with creating a calculated field in a query
    By Seahawk114 in forum Access
    Replies: 2
    Last Post: 08-13-2013, 05:23 PM
  3. Calculated field on results in the same query
    By becka11 in forum Queries
    Replies: 1
    Last Post: 05-07-2013, 05:11 PM
  4. Replies: 3
    Last Post: 06-26-2012, 02:54 PM
  5. Parameter Query on a calculated field
    By l3111 in forum Queries
    Replies: 5
    Last Post: 10-12-2011, 02:18 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