Hi John,
Well, you are going to run into troubles down the road with that SET FILTER. It'll get slower and slower as the tables grow. My advice to you would be to consider using parameterized views for the child tables. You can create one in the same database as the parent tables with:
CREATE VIEW lvPOItems AS ;
SELECT * FROM po_items WHERE pono=?po.pono
Now, if you want to open tables in the Load, (and lets assume a database name of mydbc):
USE po IN 0 ORDER pono && Or however the case maybe
USE mydbc!lvPOItems
In the form, anytime you change the record for po, you are going to want to =REQUERY('lvPOItems'). lvPOItems will always contain the subset of PO Items for the current PO.
Now, for editing PO and PO Item records, you are going to want to buffer both tables and wrap TABLEUPDATEs into a TRANSACTION to ensure that all changes are saved or lost.
>Hi,
>
>I would like to know how you would relate invoice and invoice details file , or a purchase order and purchase order details file, on a form.
>
>Presently I am coding in the Load() event of the main PO form (frmPO), which displays the PO and also displays within a Grid the items of the PO, stores in the PO_ITEMS table. They are bothed indexed on PONO.
>
>SELECT PO
>SET RELATION TO PONO INTO PO_ITEMS
>
>I have "ADD", "Edit", "Remove" command buttons on the main form which is used to Add, Edit or Remove a PO item, respectively.
>
>After the user "Adds" a new item, I code the following to display the list of items for this PO:
>
>SELECT PO_ITEMS
>SET FILTER TO PONO=PO.PONO
>
>Is this correct, or is there a better way to handle this?
>Would this work fairly quickly if my PO file and PO_ITEMS file become huge?
>
>I am fairly new to VFP 6.0, and would like some advice.
>
>Thank you very much in advance!
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05