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