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

Print report/subreports based on each date in range

Using A2K. I've been asked to modify a report currently requiring only
one date parameter to now accept a date range. The main report has 2
subreports and is not bound to a table or query. The report prints
dental and hygenist appointments for the date (one subreport for each).
The user wants to enter a date range and have one page for each date
in the date range. I'm wondering how to modify the report. The only
way I see is to create a table with a record for each date in the date
range and base the main report on this table. Then link the subreports
on the date.

Is there an easier or better way? Thanks for any help or advice.

Nov 13 '05 #1
3 7431
A simpler approach would be to use a form where the user inputs the date
range, and have the queries for both the main report and the subreport read
the value from this form.

1. Create a form with text boxes named (say) StartDate and EndDate. Since
they are unbound, set the Format property of these boxes to Short Date so
Access knows they are dates, and won't accept an invalid date. Save the form
as (say) DateRange.

2. Open the main report's query in design view. In the Criteria row under
the date field, enter:
Between [Forms].[DateRange].[StartDate] And [Forms].[DateRange].[EndDate]

3. Still in query design view, choose Parameters on the Query menu, and type
the 2 names in there as well. Again, this prevents Access misunderstanding
the date type. The two rows in the narrow dialog will actually contain:
[Forms].[DateRange].[StartDate] Date/Time
[Forms].[DateRange].[EndDate] Date/Time
Save the query.

4. Repeat steps 2 and 3 for the subreport's query.

When the main report runs, it will read the dates from the form once. Then
each time the subreport is called (typically for every record in the main
report), the subreport will also read the dates from the form, and match the
range.

You will probably have to modify the existing report so that it no longer
matches on a single date. For example, you might find that setting in the
LinkMasterFields property of the subreport control.

--
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.

<ma**********@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Using A2K. I've been asked to modify a report currently requiring only
one date parameter to now accept a date range. The main report has 2
subreports and is not bound to a table or query. The report prints
dental and hygenist appointments for the date (one subreport for each).
The user wants to enter a date range and have one page for each date
in the date range. I'm wondering how to modify the report. The only
way I see is to create a table with a record for each date in the date
range and base the main report on this table. Then link the subreports
on the date.

Is there an easier or better way? Thanks for any help or advice.

Nov 13 '05 #2
Thanks for your reply. I'm not sure how to base the main report on a
query though, for this situation. Currently, there is no query for the
main report. The user enters a single date on a form. The subreports
then each have a query that uses that date as a parameter and pulls
data from their respective tables.

Sorry if I'm dense but I'm not understanding how a query on the main
report will help me.

Nov 13 '05 #3
You already have a form with a text box for one date?
That's great. Open it in design view, and add the 2nd date.

Then open the query for the subreport.
You can see how it refers to the text box on the form?
Have it refer to the 2nd text box as well.
The previous answer gave an example.

If the main report is currently based directly on a table, you need to
create a query for it:
1. Create a new query into this table.
2. Add all the fields you need.
3. In the Criteria row, under the date field, use the same expression you
used for the subreport's criteria.
4. Save the query. Close.
5. Open the main report in design view.
6. Open the Properties box (View menu).
7. Change the RecordSource property of the report to the name of the query.

--
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.

<ma**********@hotmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Thanks for your reply. I'm not sure how to base the main report on a
query though, for this situation. Currently, there is no query for the
main report. The user enters a single date on a form. The subreports
then each have a query that uses that date as a parameter and pulls
data from their respective tables.

Sorry if I'm dense but I'm not understanding how a query on the main
report will help me.

Nov 13 '05 #4

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

Similar topics

4
by: deko | last post by:
I can't move a multi-page report to the last record unless I keep the popup form (that defined it's subreports) open. DoCmd.OpenReport "rptStandard", acViewNormal DoCmd.Close acForm,...
6
by: BlackFireNova | last post by:
Using Access 2002 I am writing a report which draws data from several different tables. I can't link all the tables in a query, as some can not be related without truncating the data. I plan...
6
by: David B | last post by:
I have a report with 2 sub reports on it. The report is an invoice and the sub reports are dropping data onto the invoice. This worked fine if generating 1 invoice at a time. I am trying to create...
3
by: Edward | last post by:
ACCESS 2k I need to design a report based on a rota system for staff at various shops. The data is effectively stored in a single table, along the lines of: Initials (e.g. BH, FG, RM etc.)...
1
by: Evets Htims | last post by:
This is Access 2003. Have a report that includes three subreports stacked on top of one another (they display order items). In the report On Open I build a recordset (to get a value from a foreign...
1
by: josecruz | last post by:
I have created a main report, which is controlled with a date range parameter from the main form. The report has several sub reports, which perform calculations (counts and averages at the subreport...
5
by: ladybug via AccessMonster.com | last post by:
I am trying to create a report using multiple tables. The first table has Employee info in it (name and id's). the next three tables have employee info for training, test, scores, etc. I am...
6
by: Brett Barry: Go Get Geek! | last post by:
Hello, I have a main report with a Record Source, a DateToday table, that has the current Month and Year. I have about 60 queries, each pulling different data via ODBC, that I am creating...
10
by: Snoopy33 | last post by:
I have a DB that I developed on access XP (2002) and deployed over a year ago. No one has had problems printing any of the reports within the DB until we started loading 2007 on new computers. ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...
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:
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.