0
votes

I have a form (single form view) “frmInvoiceClient” which holds various information on invoices sent, or to be sent, to clients. One piece of information is the invoice foreign key.

An invoice lists a number of items which add up to the total invoice. I need to add the invoice foreign key to each item.

As a first step I tried to extract the invoice foreign key from frmInvoiceClient. This is my SQL:

SELECT tblInvoices.InvoicePK, tblInvoices.ClientFK
FROM tblInvoices
WHERE (((tblInvoices.ClientFK)=[Forms]![frmInvoiceClient]![ClientFK]));

When this query fires, only one record is showing on the form frmInvoiceClient but the query gives results for all invoices for that client.

How can I make the query show the result for only the record shown on frmInvoiceClient?

1
You'll need something that uniquely identifies the invoice like an invoice id, invoice number.Rene
And where/how do you intend to use this query?June7
What do you mean by saying "when the query fires"? Are you opening another form?Wolfgang Kais

1 Answers

0
votes

Not really an answer but it's just dawned on me why this happens. I need to rethink. Perhaps a DLAST function that gives the invoice primary key that I've just made and update the Item with this. Thas plus some safeguards that prevent DLAST from being used to update items that shouldn't be updated.