1st subreport is accurate, 2nd less, all others not

tstoneami

Registered User.
Local time
Today, 15:59
Joined
Aug 5, 2013
Messages
22
If I print a single report its good every time. If I print a batch with a where in the docmd, it prints the correct records - but the logic begins to fail after the first report on the sub reports.

The random data that does print on the sub report is accurate.

If I go into debug mode, as it steps, I see that the me.field values it is checking are not accurate. Its as if the sub report on format logic is acting on the wrong record at run time.

As mentioned, a single report is fine with any of the reports that batch up. The number of records found is accurate - but the logic fails because it appears to be acting on the wrong record after the first record. Everything seems to be set up properly.

I am quite confused about this.

Thank you for any interest - I am behind the 8 ball on this one and would be willing to compensate for a solution - sorry if that is in bad form.

Regards,

t
 
As far as I can see, its all set up properly. I will try and attach the db here if you are interested in looking...the zip was posted to another forum, hence the text in the word doc addressing someone else. Thanks for your reply tho, very much.

Thanks,
t
 

Attachments

Thanks - been going a hundred mph on this project, and this data originated from another source. I REALLY appreciate it. Also, I kind of new to db work...I am sure it shows.
 
Made them both the same, it acts exactly as it did prior. Nice call, tho.
t
 
UPDATE: I had been getting a value from the calling form via the Form! method. I hard set this in the form event code. I also commented out all but one of the section checks (the top if / endif block) to make the sub report only run that and make it less intensive. No change, except it just batches a bit faster. This tells me that it is something OTHER than the processing in the form event is causing this.
 
UPDATE: I've removed all logic from the format event code and am just spitting out the data directly. It works. It seems that any logic in the format event causes the relationship between the data in the main and sub report to fail.
 
New db attached - simplified no sub report - still fails

UPDATE and NEW INFO: I removed the sub report and put a small section of it in the details of the main report. In doing so, the record source query changed appropriately.

I placed the logic corresponding to that part into the on format event. Exact same behavior. Works perfectly for a single record, anything output with a where clause (causing multiple records) causes the logic to fail. In fact, it seems as if the format event only fires once and consistently looks at the same data - causing the results to be wrong. The attached one is the simplified one - no sub report. How can I get the logic to fire as each report in the recordset is processed?
 

Attachments

I guess I sent you one with the data types back to where they were. I did test with exact same types - no diff.

Also a bit confused as to how my where could be invalid when the data is actually presented with records resulting from the where - indicating it is valid.
 
Well, I can't understand why you are telling me the where clause is wrong - it results in the correct records. Its just the form event that is failing - when you scroll thru them. Doesn't a msgbox pop up with the where contents? It's correct, right?

In terms of the matching of the data types - I tested that again here - matching them - and it made no difference.
 
Hi,

Well, I set a breakpoint in the format code, and when it paused I looked at the name it was seeing for the person in the record. It was actually showing the name from another report - the third instead of the first which it immediately stopped on.

So, when I print multiple reports, the format code is definately looking at the wrong record to act upon. What could be happening? The format event is not pointing at the current record!
 

Users who are viewing this thread

Back
Top Bottom