472,794 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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 7362
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. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.