Halked
New member
- Local time
- Today, 15:52
- Joined
- Jan 15, 2026
- Messages
- 15
Good day!
I am working on a few components of my database and have arrived at invoicing. I have created the following tables:
I may be approaching this incorrectly, so I’m open to suggestions.
In my Invoice table, I have a field called fldInvoiceTotal (Currency). This total is calculated based on the records entered in a subform (shown in the picture “Invoice 2”). The user fills out the invoice details in the subform, and currently they need to press a “Refresh Total” button to update the value stored in fldInvoiceTotal. ("Invoice Total:" as shown in "Invoice 1")
The code in the refresh button does the following
Further, I tried using a Dlookup and calculate it by each record as needed for the invoice, however that runs extremely slow.
I hope these questions are clear and concise. Thank you.
I am working on a few components of my database and have arrived at invoicing. I have created the following tables:
- tblInvoice
- tblInvoiceCost fk = fldInvoiceID
- tblTempInvoiceTotals
I may be approaching this incorrectly, so I’m open to suggestions.
In my Invoice table, I have a field called fldInvoiceTotal (Currency). This total is calculated based on the records entered in a subform (shown in the picture “Invoice 2”). The user fills out the invoice details in the subform, and currently they need to press a “Refresh Total” button to update the value stored in fldInvoiceTotal. ("Invoice Total:" as shown in "Invoice 1")
The code in the refresh button does the following
- Checks if there is a tblTempInvoiceTotals + creates it if there isn't.
- Deletes previous records in tblTempInvoiceTotals
- Inserts all records from tblInvoiceCosts into tblTempInvoiceTotals grouped by fldInvoiceID. (SQL query also sums each currency field)
- Update our current record through SQL by setting fldInvoiceTotal to what every is in the tblTempInvoiceTotals where the ID = ID.
Further, I tried using a Dlookup and calculate it by each record as needed for the invoice, however that runs extremely slow.
I hope these questions are clear and concise. Thank you.