Report can't print form field

T

tedmi

My report heading contains a text box with the following data source:
="Transactions since " & Forms!frmPrintTran!txtDate

The on-screen preview shows the date fine, but on printing, this textbox
displays #Name?
The form remains open during print.
Happens with both Access 2002 and 2007, DB structure A2000. What gives here?
Thanks.
 
D

Duane Hookom

This usually happens when there is code in the On Close of the report that
closes the form.
 
T

tedmi

Thanks, that was it. The form was closed after the report was displayed.
I didn't realize that the textbox in the header gets recalculated before
print. That's strange, because the report's query is not rerun. That leads to
this possibility:
User opens report, returns to the form, changes the date, returns to the
report and prints. The header and data body are out of synch! Had to do some
coding gymnastics to prevent this.
 
D

Duane Hookom

I am not aware of situations where a user would leave a report open then
change the dates or other criteria on the form and then print. I have created
hundreds of reports that have been opened thousands of times and never heard
of this being a problem. It might have happened without my knowledge.
 
T

tedmi

Almost happened to me just the other day. User viewed the on-screen report,
noticed the display did not match paper records in hand because the wrong
beginning date had been entered. Closed the report, re-entered date on the
form, reopened report and everything's cool. But what if she had not closed
the report, changed the form and then printed the still-open report? The
print-out would have the correct date, but the wrong data. Refreshing just
part of an object seems intrinsically wrong and a recipe for potential
disaster.

Anyway, I have just noticed that a report can be made modal, thus solving
the problem and eliminating coding gymnastics I had previously applied.

Thanks again for your time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top