I have a database that hold s figures for each quarter. I want to create a
query whereby the user can ask for the running total of the data upto the
quarter they enter into a prompt. The database stores the quarter name in
txtmonthlabel (a date field) and the quarters totals in txtdomic (a number
field) EG If the user enters March 2004 they get figures upto March 2004, if
they enter June 2004 they get total upto June 2004, in other words the query
would add March's figures to June's figures to give the totals, not just
show June's figures.
Can this be done in a query and what would the prompt criteria be?
TIA
Tony Williams 8 4073
You have a GROUP BY query, so drag the date field into the grid.
In the Total row, under this field, choose Where.
In the Criteria row, enter: = [Quarter Starting Date] And < DateAdd("q", 1, [Quarter Starting
Date])
To ensure the user enters a valid date, choose Paramters from the Query
menu, and enter:
[Quarter Starting Date] Date
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cn**********@hercules.btinternet.com...I have a database that hold s figures for each quarter. I want to create a query whereby the user can ask for the running total of the data upto the quarter they enter into a prompt. The database stores the quarter name in txtmonthlabel (a date field) and the quarters totals in txtdomic (a number field) EG If the user enters March 2004 they get figures upto March 2004, if they enter June 2004 they get total upto June 2004, in other words the query would add March's figures to June's figures to give the totals, not just show June's figures. Can this be done in a query and what would the prompt criteria be? TIA Tony Williams
Thanks Allen, have followed your guide but when I enter say June 2003 I only
get the figures for the quarterJune 2003, I don't get the figures for
January to June 2003. In other words I should be getting the total of
March's figures and June's Figures
Any help?
TIA
Tony Williams
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au... You have a GROUP BY query, so drag the date field into the grid. In the Total row, under this field, choose Where. In the Criteria row, enter: >= [Quarter Starting Date] And < DateAdd("q", 1, [Quarter Starting Date])
To ensure the user enters a valid date, choose Paramters from the Query menu, and enter: [Quarter Starting Date] Date
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
"Tony Williams" <tw@tcpinvalid.com> wrote in message news:cn**********@hercules.btinternet.com...I have a database that hold s figures for each quarter. I want to create
a query whereby the user can ask for the running total of the data upto
the quarter they enter into a prompt. The database stores the quarter name
in txtmonthlabel (a date field) and the quarters totals in txtdomic (a
number field) EG If the user enters March 2004 they get figures upto March
2004, if they enter June 2004 they get total upto June 2004, in other words the query would add March's figures to June's figures to give the totals, not just show June's figures. Can this be done in a query and what would the prompt criteria be? TIA Tony Williams
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cn**********@hercules.btinternet.com... I have a database that hold s figures for each quarter. I want to create a query whereby the user can ask for the running total of the data upto the quarter they enter into a prompt. The database stores the quarter name in txtmonthlabel (a date field) and the quarters totals in txtdomic (a number field) EG If the user enters March 2004 they get figures upto March 2004, if they enter June 2004 they get total upto June 2004, in other words the query would add March's figures to June's figures to give the totals, not just show June's figures. Can this be done in a query and what would the prompt criteria be?
You can do this easily, (for example with a subquery). Post your table
structure with some sample data and the output you need and someone will be
able to help.
Thanks John what's a subquery tho?
Tony
"John Winterbottom" <as******@hotmail.com> wrote in message
news:30*************@uni-berlin.de... "Tony Williams" <tw@tcpinvalid.com> wrote in message news:cn**********@hercules.btinternet.com...I have a database that hold s figures for each quarter. I want to create
a query whereby the user can ask for the running total of the data upto
the quarter they enter into a prompt. The database stores the quarter name
in txtmonthlabel (a date field) and the quarters totals in txtdomic (a
number field) EG If the user enters March 2004 they get figures upto March
2004, if they enter June 2004 they get total upto June 2004, in other words the query would add March's figures to June's figures to give the totals, not just show June's figures. Can this be done in a query and what would the prompt criteria be?
You can do this easily, (for example with a subquery). Post your table structure with some sample data and the output you need and someone will
be able to help.
So you want all the values so far in this calendar year?
Ask the user for the ending date:
Between DateSerial(Year([EndDate]),1,1) And [EndDate]
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cn**********@titan.btinternet.com... Thanks Allen, have followed your guide but when I enter say June 2003 I only get the figures for the quarterJune 2003, I don't get the figures for January to June 2003. In other words I should be getting the total of March's figures and June's Figures Any help? TIA Tony Williams "Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:41***********************@per-qv1-newsreader-01.iinet.net.au... You have a GROUP BY query, so drag the date field into the grid. In the Total row, under this field, choose Where. In the Criteria row, enter: >= [Quarter Starting Date] And < DateAdd("q", 1, [Quarter Starting Date])
To ensure the user enters a valid date, choose Paramters from the Query menu, and enter: [Quarter Starting Date] Date
"Tony Williams" <tw@tcpinvalid.com> wrote in message news:cn**********@hercules.btinternet.com... >I have a database that hold s figures for each quarter. I want to create a > query whereby the user can ask for the running total of the data upto the > quarter they enter into a prompt. The database stores the quarter name in > txtmonthlabel (a date field) and the quarters totals in txtdomic (a number > field) EG If the user enters March 2004 they get figures upto March 2004, > if > they enter June 2004 they get total upto June 2004, in other words the > query > would add March's figures to June's figures to give the totals, not > just > show June's figures. > Can this be done in a query and what would the prompt criteria be? > TIA > Tony Williams
Thanks Allen worked like a dream. If you get chance though could you explain
what's happening in that statement? Although it works I would like to try
and understand why it works.
Thanks
Tony
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au... So you want all the values so far in this calendar year? Ask the user for the ending date:
Between DateSerial(Year([EndDate]),1,1) And [EndDate]
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
"Tony Williams" <tw@tcpinvalid.com> wrote in message news:cn**********@titan.btinternet.com... Thanks Allen, have followed your guide but when I enter say June 2003 I only get the figures for the quarterJune 2003, I don't get the figures for January to June 2003. In other words I should be getting the total of March's figures and June's Figures Any help? TIA Tony Williams "Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:41***********************@per-qv1-newsreader-01.iinet.net.au... You have a GROUP BY query, so drag the date field into the grid. In the Total row, under this field, choose Where. In the Criteria row, enter: >= [Quarter Starting Date] And < DateAdd("q", 1, [Quarter Starting Date])
To ensure the user enters a valid date, choose Paramters from the Query menu, and enter: [Quarter Starting Date] Date
"Tony Williams" <tw@tcpinvalid.com> wrote in message news:cn**********@hercules.btinternet.com... >I have a database that hold s figures for each quarter. I want to
create a > query whereby the user can ask for the running total of the data upto the > quarter they enter into a prompt. The database stores the quarter
name in > txtmonthlabel (a date field) and the quarters totals in txtdomic (a number > field) EG If the user enters March 2004 they get figures upto March 2004, > if > they enter June 2004 they get total upto June 2004, in other words
the > query > would add March's figures to June's figures to give the totals, not > just > show June's figures. > Can this be done in a query and what would the prompt criteria be? > TIA > Tony Williams
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cn*********@hercules.btinternet.com... Thanks John what's a subquery tho?
From Access Help:
"SQL Subqueries
A subquery is a SELECT statement nested inside a SELECT, SELECT...INTO,
INSERT...INTO, DELETE, or UPDATE statement or inside another subquery"
This example shows cumulative sales in the Northwind database:
----------------------------------------
select o.orderID, o.orderDate,
(
select sum(d2.unitPrice*d2.quantity*(100-d2.discount)/100)
from [Order Details] as d2
inner join orders as o2 on d2.orderID = o2.orderID
where o2.orderDate <= o.orderDate
)
from orders as o
----------------------------------------
This is a special case of subquery called a correlated subquery - the line
"where o2.orderDate <= o.orderDate"
restricts rows in the inner query based on the value of a column in the
outer query. A correlated subquery can be used to find running totals,
sliding aggregates etc.
Since EndDate doesn't match anything else, Access assumes it's a parameter
and pops up a dialog for you to enter a value.
The Year() function extracts the year from a date.
The DateSerial() function builds a date from a year, month, and day.
The criteria therefore reads the year of the date you entered, and builds a
date for the 1st day of the year. The WHERE clause therefore asks for all
dates between the first of the year and the date you entered.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cn**********@titan.btinternet.com... Thanks Allen worked like a dream. If you get chance though could you explain what's happening in that statement? Although it works I would like to try and understand why it works. Thanks Tony "Allen Browne" <Al*********@SeeSig.Invalid> wrote in message news:41***********************@per-qv1-newsreader-01.iinet.net.au... So you want all the values so far in this calendar year? Ask the user for the ending date:
Between DateSerial(Year([EndDate]),1,1) And [EndDate]
"Tony Williams" <tw@tcpinvalid.com> wrote in message news:cn**********@titan.btinternet.com... > Thanks Allen, have followed your guide but when I enter say June 2003 I > only > get the figures for the quarterJune 2003, I don't get the figures for > January to June 2003. In other words I should be getting the total of > March's figures and June's Figures > Any help? > TIA > Tony Williams > "Allen Browne" <Al*********@SeeSig.Invalid> wrote in message > news:41***********************@per-qv1-newsreader-01.iinet.net.au... >> You have a GROUP BY query, so drag the date field into the grid. >> In the Total row, under this field, choose Where. >> In the Criteria row, enter: >> >= [Quarter Starting Date] And < DateAdd("q", 1, [Quarter Starting >> Date]) >> >> To ensure the user enters a valid date, choose Paramters from the >> Query >> menu, and enter: >> [Quarter Starting Date] Date >> >> >> "Tony Williams" <tw@tcpinvalid.com> wrote in message >> news:cn**********@hercules.btinternet.com... >> >I have a database that hold s figures for each quarter. I want to create > a >> > query whereby the user can ask for the running total of the data >> > upto > the >> > quarter they enter into a prompt. The database stores the quarter name > in >> > txtmonthlabel (a date field) and the quarters totals in txtdomic (a > number >> > field) EG If the user enters March 2004 they get figures upto March > 2004, >> > if >> > they enter June 2004 they get total upto June 2004, in other words the >> > query >> > would add March's figures to June's figures to give the totals, not >> > just >> > show June's figures. >> > Can this be done in a query and what would the prompt criteria be? >> > TIA >> > Tony Williams This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: paul |
last post by:
I have a query that takes monthly totals and rolls them up to get a
balance at a specific time code
eg:
dt bucket mon_ttl
--- ------ -------
199903 ...
|
by: ddecoste |
last post by:
I have done a bunch of looking but I am confused as to the correct way
I should proceed with this problem.
I have query that returns: It is sorted by ordnum then, linenum, then
date and it...
|
by: u473 |
last post by:
Running Totals by date misbehaving
I applied to the letter the sample code given
on http://support.microsoft.com/?kbid=290136
but it seems the running total breaks when the day number
is less...
|
by: New Guy |
last post by:
I'm trying to work with a system that somebody else built and I am
confounded by the following problem:
There is a table of payments and a table of charges. Each client has
charges and payments...
|
by: KashMarsh |
last post by:
Trying to show running totals on a report, except it needs to show one
total amount and values being subtracted from it. For example,
the report shows a Total Inventory amount (TotInvAmt). And...
|
by: BerkshireGuy |
last post by:
I have the following code:
Dim strSQL As String
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Dim intNumOfPaid, intNumOfHypoed, intNumOfNotTaken, intNumOfDeclined,
intNumOfWasted,...
|
by: Jana |
last post by:
Using Access 97.
Background:
I have a main report called rptTrustHeader with a subreport
rptTrustDetails in the Details section of the main report. The main
report is grouped by MasterClientID. ...
|
by: mochatrpl |
last post by:
I am looking for a way to make a query / report display the running
average for total dollars.
I have already set up a query to provide totals dollars per day from
which a report graphly shows...
|
by: JJM0926 |
last post by:
I'm trying to create a running totals query in access 97. I have
followed the directions on how to do it from Microsofts website
article id 138911. I took their code they had and replaced it with...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
| |