BUG: GRID: SET RELATION TO Does Not Break Relation Properly (148332)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q148332 SYMPTOMS
When you use the SET RELATION TO command to break an existing relationship,
the only records displayed from the relationship's child table are those
that are related to the current parent record and beyond. Any child records
that match parent records prior to the current parent record are left out.
WORKAROUNDMethod One
After using the SET RELATION TO command to break the relation, use the
SELECT command to select the child table, and then use the USE command.
This closes the child table.
Open the table again by using the USE command. Set the RecordSource
property of the grid back to the child alias. The code to do this would
look similar to this code:
SELECT orders && Select the child table
USE && Close the child table
USE orders ORDER cust_id && Open the child table and reset the order
ThisForm.Grid1.RecordSource = "Orders" && Reset RecordSource
ThisForm.Refresh && Refresh the form
Method Two
Use the following code to break the relation. This will allow you to see
all the child records in the grid without resetting any of the grid
properties.
ThisForm.LockScreen = .T. && Lock the form
SELECT orders && Select the child table
nChildRec = RECNO() && Store the current child record number
SELECT customer && Select the parent table
nParentRec = RECNO() && Store the current parent record number
GO TOP && Go to the top record in the parent table
Thisform.Refresh()
SET RELATION TO && Break the relation
ThisForm.Grid1.RecordSource = ThisForm.Grid1.RecordSource
* Force the grid to look at the child table again
SELECT orders && Select the child table
GO nChildRec && Go to the child record we were on
SELECT customer && Select the parent table
Go nParentRec && Go to the parent record we were on
Thisform.Refresh()
ThisForm.LockScreen = .F. && Unlock the form
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.
Modification Type: | Major | Last Reviewed: | 5/7/2003 |
---|
Keywords: | kbBug KB148332 |
---|
|