Passing a txt box value from subreport on main report (1 Viewer)

Hello1

Registered User.
Local time
Today, 06:55
Joined
May 17, 2015
Messages
271
Its my post, I suppose you mean 15?
Yes but that gives me the same error and I need the sum on main form because I use it for the total sum at the end of the report.
Holy moly, I had it working today for passing the value from sub to main and I lost that backup by accident. Now I have the total sum working and the individual page not, heh. Cant remember what did I do different from what Im doing now.

Because it gives me an error when one of the Me.[sbrSubRep].[Report]![txtFieldOnSubRep] is null (has no value, idk is there a difference) and I try to put it in the txt field, I made a recordset which checks if there are records in the subreport for the same Id as on the main report so WHERE SubRepQuery.Id = Me.MainRepId, if there are records I continue with assigning the control source to the text box, if not I skip it.
But for some reason now the recordset has records but the reference doesnt give any value back, so I get an error again and I had it all working today pfff :(
Starting to hate these reports :D
 

June7

AWF VIP
Local time
Yesterday, 19:55
Joined
Mar 9, 2014
Messages
5,470
Sorry, meant 15. Well, the technique works for me.

If you can't provide db for analysis, won't be able to help further.

A blank field/control can be either Null or empty string, usually Null.
 

Hello1

Registered User.
Local time
Today, 06:55
Joined
May 17, 2015
Messages
271
You misunderstood me, it works for me too but the problem is when the text box of the subreport which Im referring to is a blank field/control, then I get the above report and I cant avoid it with Nz or IsNull. My idea was to avoid any of the 4 subreport textboxes which have a blank field/control because they usually will have. On first page probably 3 of 4 will be a blank field/control. So I wrote some SQL to get the current subreport records from the current main report page and if there are some it means the textbox isnt empty, otherwise it is so I want to skip it from adding to the txtbox on the main report.
But for some reason my SQL sees 7 records for one subreport lets say subreport1 on the first page of the main report whats correct and no records for the other 3 subreports whats also correct, but the Me.[sbrSubRep1].[Report]![txtFieldOnSubRep1] returns empty, white the Me.[sbrSubRep2].[Report]![txtFieldOnSubRep2] returns some value and it shouldnt because it has value only on second page.
Sorry for the poor explanation, Im really tired from this, been trying to work it out for probably 24h :(

EDIT: Finally working, when I moved my stuff from page header and page footer into a grouped field section on the report and put the code OnFormat for that footer section, damn.
Now looking for next problems, probably far from over

EDIT: Yup, as I thought now printing doesnt work.
"A custom macro in this report has failed to run, and is preventing the report from rendering."
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:55
Joined
Feb 28, 2001
Messages
27,167
Are you saying that you moved something to OnFormat and printing stopped working? If so, be aware that sometimes you need to duplicate code (once for Format, once for Print) because they do different things that don't overlap.
 

Hello1

Registered User.
Local time
Today, 06:55
Joined
May 17, 2015
Messages
271
No, i moved code from page footer OnFormat to Id (the group by i added) footer OnFormat. I actually did copy the whole code from OnFormat from Id footer to Print event on Id footer, same error.

Edit: Direct printing works, printing without entering the print preview
 
Last edited:

Users who are viewing this thread

Top Bottom