Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report not showing all the linked items to the master table

Status
Not open for further replies.

Steve-vfp9user

Programmer
Feb 5, 2013
334
0
16
GB
Hello

This is a very frustrating thing for me. I have two tables call them table1 and table2.

I have placed both tables on a form in grids and linked them via an index called JOBLINK. Ok, this works perfectly when I scroll through the grid records showing each linked record in table2 to table1.

My frustration starts here.... I have created a report (not with the wizard), placed fields from table1 in the header and footer and placed fields from table2 in the detail band linking both tables with JOBLINK (which by the way is a numeric field).

When I issue as a test:

Code:
mjoblink=1000
REPORT FORM MYREPORT NOCONSOLE PREVIEW FOR JOBLINK=mjoblink

Only one record from table2 linked to table1 is shown when I know for a fact there are two records in table2.

This has never happened before and I haven't seen it either so was just wondering if something is staring me in the face, has my version of VFP9 become corrupt or am I doing something wrong?

I have also tried different lines of SET ENGINEBEHAVIOR 70/80/90 etc but to no avail.

Any help with this trivial but frustrating issue would be much appreciated.

Thank you

Steve Williams
VFP9, SP2, Windows 10
 
Steve,

A couple of points:

First, it is highly unlikely that this is caused by VFP "becoming corrupt". If that was the case, the chances are that you would not have got as far as even launching the report. I think you can discount that possibility.

Also, you can rule out SET ENGINEBEHAVIOR, unless you are using SQL to generate a cursor for the report, which, from your description, is not the case. Perhaps you meant SET REPORTBEHAVIOR? But even so, that's unlikely to be causing this problem either.

You say the tables are "linked" via a numeric field? Do you mean that you have set a relation between them? If so, are you sure the relationship is correct? You can check that by setting the relation in the command window, then skipping through one of the tables (using SKIP or GOTO), and checking to see if the related table has moved to the correct record.

Finally, are you sure the correct work area is selected at the moment that you launch the report? You say you have two grids on the form. Sometimes, if you launch a report when a grid has focus, then the work area of the grid's underlying table becomes the current work area, regardless of which work area is selected within your program. The usual solution is to programmatically set focus to another control (any control except another grid) before doing REPORT FORM.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you Mike.

I’ll look into your points and post back.

Thank you

Steve Williams
VFP9, SP2, Windows 10
 
What is the currently selected workarea when you run the report?

Relations only show up n detail records when you SET SKIP correctly.

Chriss
 
Having looked into this a bit deeper, I found the problem:

[ul]
[li]I opened the report designer[/li]
[li]Right clicked on the grey area[/li]
[li]Selected Data Environment from the menu[/li]
[li]Right clicked on the grey area in the Data Environment area[/li]
[li]Clicked on properties[/li]
[li]From the drop down menu, selected Realtion1[/li]
[li]Changed the OneToMany from .F. - False (default) to .T. - True[/li]
[/ul]

I can't believe it was the cause of my issue but perseverance resolved the problem. I do however have no idea why this happended (never happened before).

Appreciate the posts from Mike and Chriss.

Thank you

Steve Williams
VFP9, SP2, Windows 10
 
Just for the record, SET SKIP TO corresponds to exactly that.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top