Link to home
Start Free TrialLog in
Avatar of rodneygray
rodneygrayFlag for United States of America

asked on

Access 2007/2010,Variables passed using OpenArgs not printing in unbound fields on ReportLoad Event

Access is making me crazy. I am passing info from form via OpenArgs when calling report. The arguments get passed. However, when I use data from the openargs in the ReportLoad event, the data does not appear on the report when I print it. However, if I print preview, the data is there. What is happening here?
Avatar of rodneygray
rodneygray
Flag of United States of America image

ASKER

Just to clarify: I extract data from the openargs event to populate unbound fields in report header.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Can you upload a sanitized version that exhibits this behavior ?

mx
DatabaseMX: I just tried initializing my unbound title box with just text. It would not print. However, I then moved the code to initialize the unbound title box to the onprint event for the report header and the text printed. I will work on getting you an upload.
Rod
Generic version. Split db. ITSINCtest.accdb ITSINCtest-be.accdb
ok ...  what am I looking for.  What form is opening what report ?

mx
Open frmReportByGradeSelection. Enter Date range 9/20/2011 - 9/29/2011. Then select either the summary or detail report.
The reports are rptGradeSummary and rptGradeDetail.
One thing ... why are you opening the report in the Select Case Me.Frame12 ?

mx
And try this:

On the Form property sheet, set the Modal and Popup to No.  See if that resolves your issue.

mx
In doing what I said above, I physically printed a page and the Report Date Range IS filled in - just like in Print Preview.

mx
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you take a look at the order of events for Access Reports, the Load event is not even mentioned as it is with forms:
http://office.microsoft.com/en-us/access-help/order-of-events-for-database-objects-HP005186761.aspx

(Maybe previewed reports behave more like forms than printed reports do)
"Setting the form's modal and popup properties alone did not work for me - the data did not print."
That's funny because it did work for me in A2010, so apparently that problem was fixed.

mx
rodneygray - what exactly was the resolution to this problem ?

mx
Moving the code out of the Load Event:  http:#a36853887
DatabaseMX, perhaps your solution works in 2010. I was using 2007 and that solution, setting modal and pop up properties, did not work. Also, I was only using print preview to see what the report would look like without wasting toner and paper. The report will always be printed, not previewed. Moving to the code to the onprint event solved the problem. It should have worked in the onload event. Else, why even list it as an event associated with the report. Perhaps this is a bug that is fixed in 2010.
Thanks to both of you for your excellent suggestions.

Rodney
Ok ... then  re " "So the solution, as you worked out, is to not use the load event."... why did you not Accept your own answer ?

mx
I appreciated the time that both of you put into the issue. I wanted to reward someone for that time. Mbizip provided documentation of the issue in Access 2007. As his documentation agreed with the solution I used, I awarded the points to to him at the point where he discussed the issue. Again, thanks for your help. It is great to be able to have other people assisting in solving issues with their diverse skill sets.

Rod
<him >

'Her'  :-)  and thank you.  I'm glad you found the explanation helpful

Just for your own reference there is also an "Accept and award points" option which allows you to mark your own answer as accepted while awarding points to 'assisted' answers.

As the author, you don't get any points for accepting your own answer; it just amounts to giving yourself a pat on the back while highlighing your own solution for others to see.