Displaying criteria on report

hiwelcome

Registered User.
Local time
Today, 06:19
Joined
Aug 14, 2015
Messages
47
Hello,

I have a form which allows users to choose filters for a report, such as a date range. When I try to display the criteria on the report, I use a text box with =[Forms].[FrmReportFilter].[TextDate1] as the control source, for example. This works fine unless/until the user closes the filter form. If they do so before printing the report, it shows up as "#Name?" when printing. Is there a workaround for this?
 
Yeah, don't let the user close the filter form. Set the form's CloseButton property to false, and/or cancel the Unload event unless the printed report sets a flag. etc...
Code:
public ReportHasPrinted as boolean

private sub form_unload(cancel as integer)
[COLOR="Green"]   'don't allow the filter form to close until the report has printed[/COLOR]
   cancel = Not ReportHasPrinted
end sub
And on the report . . .
Code:
Private Sub ReportFooter_Print(Cancel As Integer, PrintCount As Integer)
[COLOR="Green"]   'allow the filter form to close after the report footer prints[/COLOR]
   forms("frmFileForm").ReportHasPrinted = True
End Sub
 

Users who are viewing this thread

Back
Top Bottom