?
Solved

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

Posted on 2011-09-29
19
Medium Priority
?
518 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:rodneygray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
  • 4
19 Comments
 
LVL 1

Author Comment

by:rodneygray
ID: 36852131
Just to clarify: I extract data from the openargs event to populate unbound fields in report header.
0
 
LVL 75
ID: 36853120
Can you upload a sanitized version that exhibits this behavior ?

mx
0
 
LVL 1

Author Comment

by:rodneygray
ID: 36853887
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
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 75
ID: 36854728
ok
0
 
LVL 1

Author Comment

by:rodneygray
ID: 36858730
Generic version. Split db. ITSINCtest.accdb ITSINCtest-be.accdb
0
 
LVL 75
ID: 36860457
ok ...  what am I looking for.  What form is opening what report ?

mx
0
 
LVL 1

Author Comment

by:rodneygray
ID: 36861297
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.
0
 
LVL 75
ID: 36863409
One thing ... why are you opening the report in the Select Case Me.Frame12 ?

mx
0
 
LVL 75
ID: 36864865
And try this:

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

mx
0
 
LVL 75
ID: 36865435
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
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36890979
rodneygray,

Setting the form's modal and popup properties alone did not work for me - the data did not print.

<I then moved the code to initialize the unbound title box to the onprint event for the report header and the text printed.>

You've got this figured out...

The reason for this from what I can tell (at least in Access 2007) is that the report Load event does not run when the report is being printed (acViewNormal).  It does run, however when you are previewing the report (acViewPreview).

You can verify this by putting the following in your report Load event and try running it both in normal view (printed) and preview:

Msgbox "Hello World"

So the solution, as you worked out, is to not use the load event.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36891025
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)
0
 
LVL 75
ID: 36892706
"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
0
 
LVL 75
ID: 37134268
rodneygray - what exactly was the resolution to this problem ?

mx
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37134312
Moving the code out of the Load Event:  http:#a36853887
0
 
LVL 1

Author Comment

by:rodneygray
ID: 37150774
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
0
 
LVL 75
ID: 37151067
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
0
 
LVL 1

Author Comment

by:rodneygray
ID: 37153656
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
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37157345
<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.
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question