Hi Derek,
Thank you very much...............
Truly appreciated............................
I used older sample project where all inv fields were on same table. My mistake, I forgot to delete qty and unit price fields from PurchInv table after creating PurchInvItem table.
... I'd consider using some sort of relational lookup on the purchinvitem form otherwise you can easily be selecting products that haven't been set up for the supplier that you're invoicing - with all of the knock-on problems that will cause.
You are absolutely right. That's definitely needed.
I have added disabled supplier combo on PurchInvItem form and copied combo value from PurchInv supplier combo:
procedure frmPurchInvItem_OnShow (Sender: TObject; Action: string);
begin
frmPurchInvItem.cbPurchInvItemSupplier.dbItemID := frmPurchInv.cbPurchInvSupplier.dbItemID;
end;
I was thinking adding on change event for PurchInvItem supplier combo onChange event to get product combo on PurchInvItem lists only the products belonging supplier showing on supplier combo:
procedure frmPurchInvItem_cbPurchInvItemSupplier_OnChange (Sender: TObject);
begin
frmPurchInvItem.cbPurchInvProduct.dbItemID := SQLExecute('SELECT name FROM product WHERE id = '+frmPurchInvItem.cbPurchInvItemSupplier.sqlValue);
end;
However, it didn't work. My one cell brain couldn't make the correct connection here.
Adam
God... please help me become the person my dog thinks I am.