View Full Version : Displaying Date Range on a printed report


DebbieV
06-26-2002, 06:28 AM
My date range shows up in the report on the screen but will not show up on a printed hard copy. I typed the following formula in a unbound text box on the report:
" &[Forms]![formname].[txtMCStartDate] & " and" & [Forms]![formname].[txtMCStopDate]

The form is a swithboard in which I have put text boxes and an option group for user interface. The text boxes are used to filter particular items in the reports selected in the option group. I have put a command button on this form that brings up the selected report. The problem I am having is that when the selected report is printed the date range will not show up at all, but it does appear on the screen when viewing the report.

In my cmdpreview code I have a line of code that reads:
DoCmd.OpenReport strReport, acViewPreview, , strSQL.

Do you think this is why the dates show on the screen and not on the hard copy.?
I attempted to put another cmd button for print, but was unsure of the correct syntex.

Look forward to your response
Debbie
Debbie

David R
06-26-2002, 08:06 AM
The only thing I can think of is if the form you're pulling those Start/End fields from was closed between the preview and the print, that may cause this issue...otherwise I dunno...

Opengrave
06-26-2002, 08:15 AM
I don't have anything to add but to say that I have experienced the exact same problem so I can validate your results. Very frustrating when my users say "its there (screen) but not there (paper) why?" and I can't explain it or fix the problem.

RichMorrison
06-26-2002, 08:32 AM
If this:
" &[Forms]![formname].[txtMCStartDate] & " and" & [Forms]![formname].[txtMCStopDate]
is really what you entered, it won't work.

You want
=[Forms]![formname].[txtMCStartDate] & " and" & [Forms]![formname].[txtMCStopDate]
in the Data Source of a textbox on your report.

And as David said, "formname" must be open.

RichM

Opengrave
06-26-2002, 08:50 AM
Originally posted by RichMorrison
And as David said, "formname" must be open.That is it. I commented out the code to close the form and the report prints perfectly. I'll add some code to close form when the report is closed and all should be well. Thanks!

DebbieV
06-26-2002, 09:22 AM
Originally posted by RichMorrison
If this:
" &[Forms]![formname].[txtMCStartDate] & " and" & [Forms]![formname].[txtMCStopDate]
is really what you entered, it won't work.

You want
=[Forms]![formname].[txtMCStartDate] & " and" & [Forms]![formname].[txtMCStopDate]
in the Data Source of a textbox on your report.

And as David said, "formname" must be open.

RichM

Hi Rich,
I changed the code like you said. My form is not staying open. Once I click on the preview command button, its opens the report up and that form moves to the back. I am thinking while I may see it, it is not active any longer, does sound right? Do I need th change to code somewhere else?

Debbie

David R
06-26-2002, 09:44 AM
As a matter of fact if it's interfering with you viewing the report, you can set it invisible. Access just has to be able to reference those fields somehow, and it doesn't care what you can see.