>>John,
>>Edward replied, but I thought I'd expand on his answer:
>>
>>1. Your present view is pulling in all payment records because you don't limit the payment.invfkey value to the active invoice, just tell it to match ANY invoice.
>>
>>2. In a parameterized view, you need to design the view with the WHERE clause as
>>
>>payment.invFkey = ?nInvoiceKey
>>
>>Then before you requery the view you set the nInvoiceKey value:
>>nInvoiceKey = 1234
>>select InvoiceView
>>requery()
>>thisform....MyGrid.refresh()
>>This code should be called whenever you change invoices.
>>
>>3. When loading a view, set the NoDataOnLoad property to TRUE. That way the view won't ask you for a value for nInvoiceKey when the form loads.
>>
>>HTH
>>Barbara
>>
>Edward and Barbara:
>
>I finally have the view properly established, optimized, and functional. It updates immediately, and its contents are right on. My only remaining problem is that I can't get the grid to show any data. The RecordSourceType is Alias, the RecordSource is v_Payments (the view), and each column is bound to the proper fields. In my test case, the view has one record (correct) and the amount of the payment is correct. But nobody can see it except me through VFP queries. Any ideas???
There are few steps to wake up a grid. The first thing you may try is to issue Grid.Refresh right after Requery("view"). If it's unsuccessful, then the next step is to call
Grid.Recordsource=""
Grid.Recordsource="myview"
Grid.Refresh
This is harsh way, and if you are forced to use it, it may require some more adjustment. Try it and let us know how it goes.
Edward Pikman
Independent Consultant