Link to home
Start Free TrialLog in
Avatar of Evan Cutler
Evan CutlerFlag for United States of America

asked on

MSAccess SubReport querying problem

Greetings, I am working with Access 2010 and could use a hand.
I am having difficulting with an autorefresh on a subreport.

i have the following reports:
rptMaster
srptCompare
srptThing1
srptThing2

srptCompare is independant (as far as querying and parameters are concerned), and can be run alone.  srptCompare has two subreports (Thing1, and Thing2).  Those subreports work fine as well.  srptCompare also pulls data from Thing1 and Thing2, and displays them as part of the output on srptCompare.  That also works.

My problem, is when I put srptCompare inside rptMaster.  srptCompare calls and reports all the data for Thing1 adn Thing2, and rptMaster has all of it's data...

It's the data that srptCompare retrieves from Thing1 and Thing2.  That data does not show when I run the report, unless I scroll down and click (or set focus) on that part of the report, when I do that, srptCompare fills it's data from Thing1 and Thing2 as required.

I need that to happen automatically.  If I were to run a rptMaster output, and print, I do not want to ahve to scroll all the way down and click on srptcompare to make sure it's working fine.  I need it to work on it's own.

What am I doing wrong here?
Thanks.
Avatar of mbizup
mbizup
Flag of Kazakhstan image

What view are you looking at the report in?  Report View... Print Preview... ?


Try opening the report in Print Preview if you haven't done so already.
Avatar of Evan Cutler

ASKER

Both,
The issue with Print Preview is that I cannot setfocus on srptCompare to fill the blocks from Thing1 and Thing2.  In Report View i can at least do that.
You have a lot going on there design-wise...

mbizup is usually better at "figuring out" things like this.
;-)

For me, this all would be much easier if you posted a sample of this database

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Compile the code. (From the VBA code window, click: Debug-->Compile)
10. Run the compact/Repair utility.
11. Remove any Passwords and/or security.
12. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
13. Post the explicit steps to replicate the issue.
14. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

JeffCoachman
I really wish, but it's protected information.
Even the reports themselves are protected under law.

I can try to sanitize, but that will take some time.
Thanks.
No sweat.

Again, if mbizup has a better grip on this, then please continue working with her.

Jeff
I appreciate it boag,  I'm still trying to find a solution to this.  Anything helps.
Evan
It sounds like a sequence of events problem.

Are all three subreports located in the same section on your main report?

Something you can try is placing srptCompare in a section of your main report that you know will get populated AFTER whatever section Thing1 and Thing2 are in.

For example, try placing srptCompare  in your report footer,
Thing1 and Thing2 are subreports to srptCompare.
srptCompare is a subreport of Master.
After looking further...it appears that the function "PAGE_LOAD" does not execute until focus is set.  How do I tell the subreport to execute page_load from the master report?

Thanks.
We are discussing an *Access* database and report strictly, correct?  

The reason I'm asking is that Page_Load is something I would associate with a .Net Application.

For an Access report, I would expect Report_Load...

Anyhow, if you have code in your report's Load event, try moving it to your Report's Open Event.
It's giving me an out of context error.
How do I set context?
Here's the function:

Private Sub Report_Open(Cancel As Integer)
        Me.LBL_Marital_Count.Caption = "Of " & TXTMasterTotal & ", we have information for " & Me.TXTTotal & ":"
End Sub
Hmm...

What section of your report are LBL_Marital_Count, TXTMasterTotal and TXTTotal  in?
These are all fields in the srptCompare.
LBL_Marital_Count is the label I'm trying to change.
TXTMasterTotal is a textbox that's recourdsource from another textbox in rptMaster.
TXTTotal is a calculated value on srptCompare.
Okay - where are they located on srptCompare?

Specifically which section --- Detail, Footer, Header, Group Footer.... etc?
Header
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
Header Print Event works.  That's great!!!

Thanks.

But I still need the Review view to work as well.
Any Ideas?
Sorry, The Report View.
The report events differ significantly between different views in reports, and it is very poorly documented... so it can be a bit of a guessing game at times.

What exactly are you seeing when you open the report in Report View?

The basic idea is to ensure that your code is:

a) In a event that actually executes for whatever view you are opening the report in

and

b) That any referenced controls are populated (or being populated) at the time that code runs
Does the Header Format event work for report view?

You might need that line of code in both the print and format events.
I spoke with my people...Come to find out all they wanted was Header Print event.
So we're good.

Thanks so much for the effort...that was awesome advice.

Evan
Glad to help :)