473,385 Members | 1,942 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,385 software developers and data experts.

YTD figures on a report

I have a table "tblmaintabs" that stores data that is collected from various
companies on a quarterly basis in March, June, September and December each
year (these dates are stored in a Date/time field called txtmonthlabel
formatted mmmm yyyy). I am trying to create a report that shows the figures
for the same quarter last year and the figures for the year to date this
year and last year. The value is shown on the report in the control
"txtDomfactot" based on a field with the same name in my table. I have
managed to work out how to show the same quarter's figures last year by
using DLookup, but I want to be able to show on my report the year to date
figures but cannot find the right formula to do this. The report needs to
look like this say for June 2004:

Qtrly Figures
YTD Figures
(June 2004) (June 2003)
(June2004) (June 2003)
txtDomfactot 9999 9999 888888
888888

I have built an input form "frmdate" where the user can input the current
qtr say June 2004 ( the control on the form is txtqtr2 and is also a
Date/Time format mmmm yyyy) There is a command button that opens the report
with the data showing the quarterly figures. The figure for the same qtr
last year I get from calculating the quarter number
=DateAdd("q",-4,[txtqtr2]) and using DLookup to find the value of
txtdomfactot. So far OK!

The problem is how do I calculate the year to date figure bearing in my that
in March it will be the same as the qtrly figure, in June it will be March
+June, in September it will be March + June + September and in December it
will be the total of all the individual quarters' figures.

I've tried to use DLookup in various ways eg calculating the quarter number
and then using DLookup again to get the value of txtdomfact for that quarter
using a series of IIf statements to determine which quarter I'm in, and
other derivations of this but all I get is #Error where the value should be.
Am I using the right method and can anyone give me a clue as to where I go
from here?
TIA
Tony Williams


Nov 13 '05 #1
5 3683
I would suggest creating a build in the underlying query for the
report. The build would look like this - ---Year:
Right([datefield],4) --- Then for the criteria put a parameter like so:
Forms!formtopickcriterianame!comboortextname

On the form where the user picks the ytd that they want, you can do one
of two things. You can have a text field for the user to type in the
year, (2004) or you can use a combo that will lookup only the last 4
digits of the date field, being the year, and group by it. This will
give you the years that exist in your table.

Then the report just finds records or totals that exist only within
that criteria ( date having those last 4 digits) - that gives you the
year.

Nov 13 '05 #2
try this in the query : Right([DATE],4) then put criteria to a field
on a form for the user to choose date. Should restrict to year.

Nov 13 '05 #3
Thanks could you explain what you mean by "create a build"?
Thanks for your help
Tony
"misscrf" <mi*****@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I would suggest creating a build in the underlying query for the
report. The build would look like this - ---Year:
Right([datefield],4) --- Then for the criteria put a parameter like so:
Forms!formtopickcriterianame!comboortextname

On the form where the user picks the ytd that they want, you can do one
of two things. You can have a text field for the user to type in the
year, (2004) or you can use a combo that will lookup only the last 4
digits of the date field, being the year, and group by it. This will
give you the years that exist in your table.

Then the report just finds records or totals that exist only within
that criteria ( date having those last 4 digits) - that gives you the
year.

Nov 13 '05 #4
Sure, Tony. To create a build on a field, do the following.

1) go to the design view of your report

2) bring up the form properties, by right clicking on the left top
corner of the report.

3) go to it's control source, and click the ... to invoke the query
builder

4) bring in every field you need for your report - from here I tend to
preview this query as I work to make sure I am getting the data I want
to see, if I need grouping, as a create formulas, I keep checking it to
ensure that what I am doing will show up on the report correctly.

5) once you have all of the fields you need in the query design, on an
empty field space, right click where the field name goes, and choose
the builder. Then make the formula. You will have to play around with
syntax. Don't be afraid of the help.

6) read this whole step before doing it! Don't try to save the query
by clicking save - INSTEAD click the inner x to close the query. When
it asks if you want to save the changes you have made to the underlying
query click YES. Then it becomes the control source of your report.

Many times I have tried to do formulas in fields on the report, and
they tend to work better in the query builder and then placed as a
field on the report.

You can also place your criteria in the query, which would be
references to form fields. I rarely have a report that doesn't use
that.

Nov 13 '05 #5
Sure, Tony. To create a build on a field, do the following.

1) go to the design view of your report

2) bring up the form properties, by right clicking on the left top
corner of the report.

3) go to it's control source, and click the ... to invoke the query
builder

4) bring in every field you need for your report - from here I tend to
preview this query as I work to make sure I am getting the data I want
to see, if I need grouping, as a create formulas, I keep checking it to
ensure that what I am doing will show up on the report correctly.

5) once you have all of the fields you need in the query design, on an
empty field space, right click where the field name goes, and choose
the builder. Then make the formula. You will have to play around with
syntax. Don't be afraid of the help.

6) read this whole step before doing it! Don't try to save the query
by clicking save - INSTEAD click the inner x to close the query. When
it asks if you want to save the changes you have made to the underlying
query click YES. Then it becomes the control source of your report.

Many times I have tried to do formulas in fields on the report, and
they tend to work better in the query builder and then placed as a
field on the report.

You can also place your criteria in the query, which would be
references to form fields. I rarely have a report that doesn't use
that.

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stuart Grant | last post by:
I am trying to print out a report in a VB6 program but can't get the figures in a column lined up. In QB it was simple. Format all the numbers with "###,###.##" or equivalent and print at a tab. ...
5
by: Sarah Wang | last post by:
Hello everyone! I want to calculate zprob(the area under the normal curve) with python and I managed to find a function from the internet. But the problem is that the function calculates the...
2
by: K.Simon | last post by:
Hello, I'm converting books from Docbook to HTML-chunk. For my needs it is necessary to append the list of figures at the end instead the beginning of the book as it is default in docbook. After...
6
by: Robert J. O'Hara | last post by:
I'm one of those people who practices what some consider "dull" and others consider "elegantly conservative" page design. I appreciate good traditional typography and standards-compliant liquid...
5
by: Robert J. O'Hara | last post by:
For some time I've struggled with the problem of displaying simple captioned figures on webpages in a way that is robust and scalable. I tend to make "boring" (um, I mean "conservatively elegant")...
2
by: Deano | last post by:
One thing that slightly annoys me about my app is a side-affect from the way it processes figures. It calculates salaries very precisely (to the penny) but there are rounding issues that cause...
1
by: oyk | last post by:
I want to average figures by row. The rows of the queries consist of figures for Yr1Salary, Yr2Salary, Yr3Salary etc. until Yr28. I want to average these figures. Anyone able to help me? TQ.
21
by: Grant Edwards | last post by:
I need to be able to generate a PDF report which consists mostly of vector images (which I can generate as encapsulated Postscript, PDF, or SVG). What I need is a way to combine these figures...
1
by: whisper26 | last post by:
Hi Firstly I'm using Access 2003 for my little project. I've got a bit of a problem. Basically I've been designing a database which has a table for supplier contact details,another containing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
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...

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.