R
Raul Sousa
I have a database to manage inventory, invoices and receipts.
I have two tables for the receipts, Receipts and ReceiptsDetails.
The table Receipts has the fields ReceiptN, Date and Clients. The table
ReceiptsDetails has the fields ReceiptN, Invoice and Value.
The two tables are related by the field ReceiptN.
I am building the form to create new receipts.
This form has a main form and a subform.
I would like the form to have datasheet view with the fields:
1. Invoice – Document to be paid;
2. Open Value – Invoice amount not yet paid;
3. Value – Amount being paid;
4. Remaining Value – open value after current payment.
So, I have as datasource for the subform this query
SELECT Invoice.NIF AS Client, Invoice.DocID AS Invoice,
(nz([Qtt]*[price]*(1+[tax]),0)-(nz([value],0))) AS Open,
Receipts.Value, Receipts.ReceiptN
FROM (Invoice LEFT JOIN REceipts ON Invoice.DocID =
REceipts.Invoice) INNER JOIN Sales ON Invoice.DocID =
Sales.DocID
WHERE (((Left([Invoice].[DocID],2))="IN")) OR
(((Left([Invoice].[DocID],1))="N"));
PROBLEMS:
1. This query is not updatable. How is it possible to have it updatable?
2. I would like to have invoice field showing only the invoices for the
client on the main form. I am thinking of changing it to a combo box, with
the line source being a query. Something like:
SELECT …
Where Invoice.NIF = mainform.Client
How do I correctly state this Expression (mainform.Client)?
I have two tables for the receipts, Receipts and ReceiptsDetails.
The table Receipts has the fields ReceiptN, Date and Clients. The table
ReceiptsDetails has the fields ReceiptN, Invoice and Value.
The two tables are related by the field ReceiptN.
I am building the form to create new receipts.
This form has a main form and a subform.
I would like the form to have datasheet view with the fields:
1. Invoice – Document to be paid;
2. Open Value – Invoice amount not yet paid;
3. Value – Amount being paid;
4. Remaining Value – open value after current payment.
So, I have as datasource for the subform this query
SELECT Invoice.NIF AS Client, Invoice.DocID AS Invoice,
(nz([Qtt]*[price]*(1+[tax]),0)-(nz([value],0))) AS Open,
Receipts.Value, Receipts.ReceiptN
FROM (Invoice LEFT JOIN REceipts ON Invoice.DocID =
REceipts.Invoice) INNER JOIN Sales ON Invoice.DocID =
Sales.DocID
WHERE (((Left([Invoice].[DocID],2))="IN")) OR
(((Left([Invoice].[DocID],1))="N"));
PROBLEMS:
1. This query is not updatable. How is it possible to have it updatable?
2. I would like to have invoice field showing only the invoices for the
client on the main form. I am thinking of changing it to a combo box, with
the line source being a query. Something like:
SELECT …
Where Invoice.NIF = mainform.Client
How do I correctly state this Expression (mainform.Client)?