473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do I make my query sum values over the past two weeks, starting today?

This is a two part question.

My Query looks something like this:

Date//Operator//Total Parts//Total Earned Hours//Total Time

1. I want the query to sum Parts/Hours/Time over the past two weeks, starting from the current date. I'm trying different variations of the Date() but I can't find any helpful material online.


2. I also want to divide the Earned Hours column by Total Time column. I tried to create a report and add a field that divides the two values. This DOES work, however it won't let me sort the new custom field from largest to smallest or vice versa using the Add Group/Sort function. What am I doing wrong here?
Sep 28 '12 #1
2 1929
Rabbit
12,516 Expert Mod 8TB
1) Date() - 14 will give you 2 weeks ago. Or you could use the DateAdd() function and give it a negative number.

2) You will have to sort by the formula if that's possible, I don't know if it is off the top of my head. If not, calculate it in the query and sort by the new field.
Sep 28 '12 #2
zmbd
5,501 Expert Mod 4TB
Do you need running totals or over all type calc.

You don't mention which version you're using... 2003, I don't think you can sort/group at report time on a calculated field as the value isn't actually stored anywhere; however, in 2007 and 2010 you should be able to (This article mentions doing so, but not how to: http://office.microsoft.com/en-us/ac...010108354.aspx)

Please be aware that normally the site rules allow only one question per thread. This makes it much easier for the "Experts" (Rabbit, NeoPa, and so many others) to help by focusing on the one issue, and for people to search the site for answers in that they don't have to un-wind a multi-level question.
Sep 28 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nick | last post by:
Im trying to build a graph of values from a counterTable. (Eg - get a list of how many times a page was requested in a week period with each y value being a day). If the table looks like...
1
by: Eskil | last post by:
Hi I have a form that supplies my query with information on two different variables. The form uses a lookup to display a list of 5 different customer types and 5 different types of...
2
by: ralamo | last post by:
When i execute the following insert query, the above mentioned error is coming. Anything wrong in the query? INSERT INTO ECN_1 (Old_SbPartNo, Old_PartDesc, Old_ManPartNo, Old_Manuf,...
3
by: kathyburke40 | last post by:
Odd problem. I have a table in the following format: DocID Question1 Question2 Question3 ------------------------------------------------ 298 1, 2, 3 or 0 Each Question...
9
by: Kosmos | last post by:
I'm getting this error message: Number of query values and destination fields are not the same. This is the code: INSERT INTO tblDateDifference ( DateDifference ) SELECT tblContracts.EndDate...
8
ChaseCox
by: ChaseCox | last post by:
Is there a way to pass the values of a text box, will call it "txtbox" into a query using the In statement without using the txtbox.SetFocus function? I am needing to use more than one txt box to...
2
by: cypriot | last post by:
Hi. I am developing an application program in java. I use MsAccess for keeping data. I had a problem with sql insert method. public void AddPatient() { String...
2
by: Luka Djigas | last post by:
Hello everyone, please, I need your help. I'm new to python, so I don't know if this will seem like a stupid question to some of you ... I have a need to write to a file (or just print on...
3
by: monion | last post by:
One more question. How can I get query values assign them to a variable, but not show them? for example size, $f4 in the following: How can I pass that value $f4 to the form handle page to submit...
3
adascat
by: adascat | last post by:
Could anyone find out the problem why this is happening? The number of query values I am trying to insert is exactly the same as in my accdb file actually. Number of query values and destination...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.