access 2010 Report unbound textbox blank

nk100

New member
Local time
Today, 08:25
Joined
May 25, 2012
Messages
7
I have a report (Access 2010) on which I have two unbound text boxes (set by VBA) - txtStartDate and txtEndDate to show the date range the report is filtered. I can see their values in ReportView but in Print Preview they are blank and ther values wiped out.
Can anybody help. Thanks
 
What event are you setting them? There are events that run in report view but not in preview, and vice-versa. I rarely use report view, so typically I'd have that type of code in the format event of the section containing the textboxes.
 
Thanks for you quick anser
I have set them not from the report events. I have a form which set filter, open the report in ReportView and set up those two boxes.
The report is filtered, the boxes contain correct information. Then I want to open the report in Print preview and the boxes are not only blank but returning back to ReportViiew the information is not there.
 
If you're using the form code, you won't be able to. Once the report is opened in preview mode, it's static (as you've found). It's no different than if you were printing it. Once printed, you obviously can't change a value. You'll need to do it in a report event as I mentioned. You can either refer back to the form or use OpenArgs.
 
Thanks Paul
Can I remember their values in variable and on format even set them again?
 
I wonder - the text boxes have values in Report view - it shouldn't matter how they have got their values - by typing or by any other means. Why their value is gone when the report is open in Print Preview? What do you think?
 
Why their value is gone when the report is open in Print Preview? What do you think?
Paul already told you. Print Preview is different from Report view.

Put a reference to the form in their control source like he said:

=[Forms]![FormNameHere]![ControlNameHere]
 
You haven't shown the code, but I assume you have:

DoCmd.OpenReport...
Reports!ReportName.Textbox = Whatever

In Report view that will work, in Preview it won't. Like I said, Preview mode is static. You can't change values from outside the report after opening the report in Preview or Print modes.
 
Thank you very much for your help.
I did solve it like you suggested.
From the form I put the values in TempVars.
I did retrieve the values on the report section OnFormat event and it works.

NK
 
Last edited:

Users who are viewing this thread

Back
Top Bottom