Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a form's DE / getting all the child records
Message
From
28/07/1999 10:46:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Using a form's DE / getting all the child records
Miscellaneous
Thread ID:
00247149
Message ID:
00247149
Views:
52
I'm having some problems with a one-to-many report in a "borrowed" data environment.

In this application, the user is viewing records on a form, and running various searches and filters to select the records he wants. When he has found the correct record(s), he clicks the Report button on the form and selects the proper report, which appears in the Preview window.

I would like to use the form's private data environment as the report's data environment. This is especially desirable if the report is being printed off a filtered table, since running these filter queries can take a long time and I don't want the user to have to wait while the query is run all over again to generate the report cursor. I have found no problems with this if I am running a single-table report and make sure that my record pointer is restored after the report is run.

However, things don't work as nicely if the report is based on multiple tables. The form's data environment is a one-to-many relation, with the child records displayed on a grid. I would like to have a report which mimics this, with the parent data displayed in the group header and the child data in detail lines. I designed the report with the same relation in place, then emptied the report's data environment, figuring it would interpret the relation it found at runtime in the same way.

But the results have been peculiar. If I start the report with the parent table selected, only the first child record prints in the detail section. If I start the report with the child table selected, I get lots of detail lines, but they don't belong to the parent records.

I'm guessing that I have to add some code to the report's data environment to get it to see the parent-child relation as one-to-many. (I have seen a statement that the default setting of the OneToMany property of relations is .F.) And I have experimented with the techniques in Microsoft's Q145816 to access the running report's data environment. Unfortunately, I can't seem to use the report pointer (set with the NAME clause of the REPORT command) to "see" the borrowed data environment -- it comes up with a count of zero members when I try to snapshot them with aMembers().

Does anyone have any suggestions?

Thanks,
BEW
Barbara Weitbrecht
Archives Division
National Air & Space Museum
Smithsonian Institution

"Magic is real... unless defined as integer"
Next
Reply
Map
View

Click here to load this message in the networking platform