Timely: How do I add a date range query for a report?

  • Thread starter Thread starter David
  • Start date Start date
D

David

This subject may be out there but I haven't come across
it yet.

I am using the "Contacts Management" database downloaded
from the MS website w/ templates. I have added an
additional report which needs to ask for a date range for
the output.

Where do I start?

Need quickly for boss and will appreciate (in advance)
any direction!

Thanks!
 
Hi David,

I only have Access 97 in front of me at the moment so I am using the Contact Management sample
database that comes with the program. I would imagine it is virtually the same as the database in
front of you. I'm going to have to make some assumptions here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a SQL statement as its Record Source. My guess
would be that you have based the report directly from the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in query design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no spaces).
Now open the query to test. Two prompts will appear asking for a starting date and ending date.

4. Now open your new report in Design View and make the Record Source for the report be this new
saved query we made. Close and save the report changes. Now when you open the report, the prompts
will appear and the data in the report *should* only display the records between the two dates you
specify.

This is a very generic way of doing this. A more advanced technique is to create a form that will
prompt for the date range. This particular database sample already has such a form for you. If you
would like to use this same form you could try the following steps:

1. Create a new query but do not select any tables. Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]![Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View | Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the ACTUAL name of your new report.

5. Save and close the report.

Now try opening the report from the Database Window or the Switchboard. The form called "Report Date
Range" will first appear asking for the date range. Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with only call dates in the specified date range.

I hope that helps.
Whew!!
 
Jeff, Thank you kindly for your reply.

I'll give it a whirl and let ya know.

David

-----Original Message-----
Hi David,

I only have Access 97 in front of me at the moment so I
am using the Contact Management sample
database that comes with the program. I would imagine it
is virtually the same as the database in
front of you. I'm going to have to make some assumptions
here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the
information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a SQL
statement as its Record Source. My guess
would be that you have based the report directly from
the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in query design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no spaces).
Now open the query to test. Two prompts will appear
asking for a starting date and ending date.
4. Now open your new report in Design View and make the
Record Source for the report be this new
saved query we made. Close and save the report changes.
Now when you open the report, the prompts
will appear and the data in the report *should* only
display the records between the two dates you
specify.

This is a very generic way of doing this. A more
advanced technique is to create a form that will
prompt for the date range. This particular database
sample already has such a form for you. If you
would like to use this same form you could try the following steps:

1. Create a new query but do not select any tables.
Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]! [Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the
Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's
Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View |
Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the
ACTUAL name of your new report.
5. Save and close the report.

Now try opening the report from the Database Window or
the Switchboard. The form called "Report Date
Range" will first appear asking for the date range.
Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with
only call dates in the specified date range.
 
Also.. (thought I mentioned this in my original post)

The original "Weekly Report" in this DB works great, but
it omits a critical piece of information -- the "Company
Name" that was contacted. Mgt certainly wants that in
the report!

Thanks again.
-----Original Message-----
Hi David,

I only have Access 97 in front of me at the moment so I
am using the Contact Management sample
database that comes with the program. I would imagine it
is virtually the same as the database in
front of you. I'm going to have to make some assumptions
here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the
information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a SQL
statement as its Record Source. My guess
would be that you have based the report directly from
the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in query design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no spaces).
Now open the query to test. Two prompts will appear
asking for a starting date and ending date.
4. Now open your new report in Design View and make the
Record Source for the report be this new
saved query we made. Close and save the report changes.
Now when you open the report, the prompts
will appear and the data in the report *should* only
display the records between the two dates you
specify.

This is a very generic way of doing this. A more
advanced technique is to create a form that will
prompt for the date range. This particular database
sample already has such a form for you. If you
would like to use this same form you could try the following steps:

1. Create a new query but do not select any tables.
Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]! [Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the
Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's
Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View |
Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the
ACTUAL name of your new report.
5. Save and close the report.

Now try opening the report from the Database Window or
the Switchboard. The form called "Report Date
Range" will first appear asking for the date range.
Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with
only call dates in the specified date range.
 
You're welcome, hope it helps.

--
Jeff Conrad
Access Junkie
Bend, Oregon

David said:
Jeff, Thank you kindly for your reply.

I'll give it a whirl and let ya know.

David

-----Original Message-----
Hi David,

I only have Access 97 in front of me at the moment so I
am using the Contact Management sample
database that comes with the program. I would imagine it
is virtually the same as the database in
front of you. I'm going to have to make some assumptions
here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the
information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a SQL
statement as its Record Source. My guess
would be that you have based the report directly from
the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in query design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no spaces).
Now open the query to test. Two prompts will appear
asking for a starting date and ending date.
4. Now open your new report in Design View and make the
Record Source for the report be this new
saved query we made. Close and save the report changes.
Now when you open the report, the prompts
will appear and the data in the report *should* only
display the records between the two dates you
specify.

This is a very generic way of doing this. A more
advanced technique is to create a form that will
prompt for the date range. This particular database
sample already has such a form for you. If you
would like to use this same form you could try the following steps:

1. Create a new query but do not select any tables.
Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]! [Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the
Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's
Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View |
Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the
ACTUAL name of your new report.
5. Save and close the report.

Now try opening the report from the Database Window or
the Switchboard. The form called "Report Date
Range" will first appear asking for the date range.
Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with
only call dates in the specified date range.
I hope that helps.
Whew!!

--
Jeff Conrad
Access Junkie
Bend, Oregon




.
 
Sure, we can do that David.
Would you like to Super Size that order for only a dollar more?
(kidding)

Lots of ways to do this, here is just one way.

1. Open the Weekly Call Summary report in Design View.

2. Go to the report's Properties List ( View | Properties )

3. Find the report's Record Source, it will be on the 'Data' or 'All' tabs.

4. On that line you will see a little button like so (...) on the right side. Click it once to
bring up a SQL Statement builder for this report. This is where your report is getting the data.

5. You should see the Contacts and Calls tables in the upper portion of the query builder. Now use
the right scroll button on the bottom of this window until you see some empty columns available.

6. Scroll down the Contacts table in the upper area until you come to the field called CompanyName.
Click and HOLD that field with your left mouse button and drag it onto one of the empty columns. You
have now added this field to the report's Record Source.

7. Close this SQL window and a box will ask if you want to save the changes. Click Yes.

8. Now close the report's Properties List dialog box.

9. Go to the report's Field List ( View | Field List ) and you should now see CompanyName in the
list. Click, HOLD with your left mouse button, and drag it into the Detail section of your report.
Position it just where you want in the Detail section and make any formatting changes you desire.

10. Save and close the report. Then test.

11. Tell your manager you were up all night working on this and then ask him/her for a raise.

--
Jeff Conrad
Access Junkie
Bend, Oregon

David said:
Also.. (thought I mentioned this in my original post)

The original "Weekly Report" in this DB works great, but
it omits a critical piece of information -- the "Company
Name" that was contacted. Mgt certainly wants that in
the report!

Thanks again.
-----Original Message-----
Hi David,

I only have Access 97 in front of me at the moment so I
am using the Contact Management sample
database that comes with the program. I would imagine it
is virtually the same as the database in
front of you. I'm going to have to make some assumptions
here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the
information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a SQL
statement as its Record Source. My guess
would be that you have based the report directly from
the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in query design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no spaces).
Now open the query to test. Two prompts will appear
asking for a starting date and ending date.
4. Now open your new report in Design View and make the
Record Source for the report be this new
saved query we made. Close and save the report changes.
Now when you open the report, the prompts
will appear and the data in the report *should* only
display the records between the two dates you
specify.

This is a very generic way of doing this. A more
advanced technique is to create a form that will
prompt for the date range. This particular database
sample already has such a form for you. If you
would like to use this same form you could try the following steps:

1. Create a new query but do not select any tables.
Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]! [Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the
Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's
Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View |
Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the
ACTUAL name of your new report.
5. Save and close the report.

Now try opening the report from the Database Window or
the Switchboard. The form called "Report Date
Range" will first appear asking for the date range.
Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with
only call dates in the specified date range.
I hope that helps.
Whew!!
 
JEFF!!! PURE GENIOUS!

I can't believe HOW EASY this was. I wish I had
discovered this discussion board weeks ago; I've been
beating my brains out on this. I haven't touched access
in about 5 years and when I started following your
directions.. it began clicking...

I prayed and God must have sent you to my original post
for help; BLESS YOU!

David

P.S. Stay watching! I may have other issues down the road
(does "...ernstbrothers.com" work??!!)
-----Original Message-----
Sure, we can do that David.
Would you like to Super Size that order for only a dollar more?
(kidding)

Lots of ways to do this, here is just one way.

1. Open the Weekly Call Summary report in Design View.

2. Go to the report's Properties List ( View | Properties )

3. Find the report's Record Source, it will be on the 'Data' or 'All' tabs.

4. On that line you will see a little button like so
(...) on the right side. Click it once to
bring up a SQL Statement builder for this report. This
is where your report is getting the data.
5. You should see the Contacts and Calls tables in the
upper portion of the query builder. Now use
the right scroll button on the bottom of this window
until you see some empty columns available.
6. Scroll down the Contacts table in the upper area
until you come to the field called CompanyName.
Click and HOLD that field with your left mouse button
and drag it onto one of the empty columns. You
have now added this field to the report's Record Source.

7. Close this SQL window and a box will ask if you want
to save the changes. Click Yes.
8. Now close the report's Properties List dialog box.

9. Go to the report's Field List ( View | Field List )
and you should now see CompanyName in the
list. Click, HOLD with your left mouse button, and drag
it into the Detail section of your report.
Position it just where you want in the Detail section
and make any formatting changes you desire.
10. Save and close the report. Then test.

11. Tell your manager you were up all night working on
this and then ask him/her for a raise.
--
Jeff Conrad
Access Junkie
Bend, Oregon

Also.. (thought I mentioned this in my original post)

The original "Weekly Report" in this DB works great, but
it omits a critical piece of information -- the "Company
Name" that was contacted. Mgt certainly wants that in
the report!

Thanks again.
-----Original Message-----
Hi David,

I only have Access 97 in front of me at the moment so
I
am using the Contact Management sample
database that comes with the program. I would imagine
it
is virtually the same as the database in
front of you. I'm going to have to make some
assumptions
here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the
information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a
SQL
statement as its Record Source. My guess
would be that you have based the report directly from
the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in
query
design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no spaces).
Now open the query to test. Two prompts will appear
asking for a starting date and ending date.
4. Now open your new report in Design View and make
the
Record Source for the report be this new
saved query we made. Close and save the report
changes.
Now when you open the report, the prompts
will appear and the data in the report *should* only
display the records between the two dates you
specify.

This is a very generic way of doing this. A more
advanced technique is to create a form that will
prompt for the date range. This particular database
sample already has such a form for you. If you
would like to use this same form you could try the following steps:

1. Create a new query but do not select any tables.
Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]! [Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the
Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's
Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View |
Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report.
Canceling
report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the
ACTUAL name of your new report.
5. Save and close the report.

Now try opening the report from the Database Window or
the Switchboard. The form called "Report Date
Range" will first appear asking for the date range.
Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with
only call dates in the specified date range.
I hope that helps.
Whew!!

--
Jeff Conrad
Access Junkie
Bend, Oregon

This subject may be out there but I haven't come across
it yet.

I am using the "Contacts Management" database downloaded
from the MS website w/ templates. I have added an
additional report which needs to ask for a date
range
for
the output.

Where do I start?

Need quickly for boss and will appreciate (in advance)
any direction!

Thanks!


.
 
David said:
JEFF!!! PURE GENIOUS!

Oh thanks, that was very kind to say. You just made my day!
I can't believe HOW EASY this was. I wish I had
discovered this discussion board weeks ago; I've been
beating my brains out on this. I haven't touched access
in about 5 years and when I started following your
directions.. it began clicking...

*Easy* is always a relative term.
You must use Access more often; you will then become one with the Access Borg.
I prayed and God must have sent you to my original post
for help; BLESS YOU!

Ok, now you just got me blushing. :-)
P.S. Stay watching! I may have other issues down the road
(does "...ernstbrothers.com" work??!!)

Posted e-mail address goes to never-never land.
Best way to reach me is here in the NGs.

Good luck on your project.

--
Jeff Conrad
Access Junkie
Bend, Oregon
-----Original Message-----
Sure, we can do that David.
Would you like to Super Size that order for only a dollar more?
(kidding)

Lots of ways to do this, here is just one way.

1. Open the Weekly Call Summary report in Design View.

2. Go to the report's Properties List ( View | Properties )

3. Find the report's Record Source, it will be on the 'Data' or 'All' tabs.

4. On that line you will see a little button like so
(...) on the right side. Click it once to
bring up a SQL Statement builder for this report. This
is where your report is getting the data.
5. You should see the Contacts and Calls tables in the
upper portion of the query builder. Now use
the right scroll button on the bottom of this window
until you see some empty columns available.
6. Scroll down the Contacts table in the upper area
until you come to the field called CompanyName.
Click and HOLD that field with your left mouse button
and drag it onto one of the empty columns. You
have now added this field to the report's Record Source.

7. Close this SQL window and a box will ask if you want
to save the changes. Click Yes.
8. Now close the report's Properties List dialog box.

9. Go to the report's Field List ( View | Field List )
and you should now see CompanyName in the
list. Click, HOLD with your left mouse button, and drag
it into the Detail section of your report.
Position it just where you want in the Detail section
and make any formatting changes you desire.
10. Save and close the report. Then test.

11. Tell your manager you were up all night working on
this and then ask him/her for a raise.
--
Jeff Conrad
Access Junkie
Bend, Oregon

Also.. (thought I mentioned this in my original post)

The original "Weekly Report" in this DB works great, but
it omits a critical piece of information -- the "Company
Name" that was contacted. Mgt certainly wants that in
the report!

Thanks again.

-----Original Message-----
Hi David,

I only have Access 97 in front of me at the moment so I
am using the Contact Management sample
database that comes with the program. I would imagine it
is virtually the same as the database in
front of you. I'm going to have to make some assumptions
here so bear with me. Hopefully you can
fill in any blanks.

1. I'm assuming you need to make a report from the
information in the Calls table here since that
has a Date/Time field called CallDate.

2. Your report can use a table, a saved query, or a SQL
statement as its Record Source. My guess
would be that you have based the report directly from
the table. What I would do is create a saved
query from the Calls table with all the fields you need.

3. In the criteria line for the CallDate field in query
design put this in:
Between [Enter Starting Date] And [Enter Ending Date]

Save the query with a useful name (preferably with no
spaces).
Now open the query to test. Two prompts will appear
asking for a starting date and ending date.

4. Now open your new report in Design View and make the
Record Source for the report be this new
saved query we made. Close and save the report changes.
Now when you open the report, the prompts
will appear and the data in the report *should* only
display the records between the two dates you
specify.

This is a very generic way of doing this. A more
advanced technique is to create a form that will
prompt for the date range. This particular database
sample already has such a form for you. If you
would like to use this same form you could try the
following steps:

1. Create a new query but do not select any tables.
Switch to SQL view ( View | SQL View ) and copy
paste this in the SQL Editor:

SELECT Calls.*
FROM Calls
WHERE (((Calls.CallDate)>=[forms]![Report Date Range]!
[Beginning Call Date] And
(Calls.CallDate)<=[forms]![Report Date Range]![Ending
Call Date]));

2. Save the query as qryMyNewReport

3. Open your new report in Design View and make the
Record Source for the report be qryMyNewReport.
The Record Source can be found on the report's
Properties list ( View | Properties ). It will be on
the "Data" or "All" tabs.

4. Now go to the code window for this report ( View |
Code ). Copy paste all this code below the
first two lines that say:
Option Compare Database
Option Explicit

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for this report. Canceling
report..."
Cancel = -1
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "Report Date Range"
End Sub

Private Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , ,
acDialog, "rptMyNewReport"
If Not IsLoaded("Report Date Range") Then
Cancel = True
End If
End Sub

Make sure you change rptMyNewReport above with the
ACTUAL name of your new report.

5. Save and close the report.

Now try opening the report from the Database Window or
the Switchboard. The form called "Report Date
Range" will first appear asking for the date range.
Enter whatever dates you would like and then hit
the Preview button. Your new report should appear with
only call dates in the specified date range.

I hope that helps.
Whew!!

--
Jeff Conrad
Access Junkie
Bend, Oregon

This subject may be out there but I haven't come across
it yet.

I am using the "Contacts Management" database
downloaded
from the MS website w/ templates. I have added an
additional report which needs to ask for a date range
for
the output.

Where do I start?

Need quickly for boss and will appreciate (in advance)
any direction!

Thanks!


.
 
Back
Top