oCustomer.LoadInvoices()
oCustomer.oInvoices.lAllowLoad = .T.
oCustomer.oInvoices.Add(...)
See the problem?>DEFINE CLASS Col AS Collection > lAllowLoad = .T. > PROCEDURE Add(eItem, cKey, eBeforere, eAfter) > IF NOT This.lAllowLoad > ERROR 1740 > ENDIF > ... > ENDPROC >ENDDEFINE >>>
>> >>PROCEDURE LoadInvoices >> >>This.oInvoices = CREATEOBJECT("Col") >> >>SELECT *; >> FROM Invoices; >> WHERE CustomerId = iCustomerId; >> INTO CURSOR Temp1 >> >>SELECT Temp1 >>SCAN >> >> oInvoice = CREATEOBJECT("Invoice", Temp1.InvoiceId) >> >> ** Add the invoice object to the collection >> This.oInvoices.Add(oInvoice) >> >>ENDSCAN >> >>RETURN >> >> >>DEFINE CLASS Col AS Collection >> PROCEDURE Add(eItem, cKey, eBeforere, eAfter) >> ENDPROC >>ENDDEFINE >> >>>>