I have a Form that indexes a table of invoices ("tblInvoices"
. My invoice form has a subform corresponding to a scratch table ("tblInvoiceScratch"
for generating the invoice report. I'm currently doing all of my invoice calculation in VB in "frmInvoices," and I'd like to populate "tblInvoiceScratch" with the results, e.g.,
I'm having a heck of a time trying to do this. In subfrmInvoiceScratch I have a simple subroutine to add a new record:
Which I call from frmInvoices like
But the GoToRecord Action adds the new record to tblInvoices, not to tblInvoiceScratch (though the data is getting written to the 1st record of tblInvoiceScratch correctly). When I tried to be more explicit in my GoToRecord Action, e.g.,
I get errors that say "the object 'tblInvoiceScratch' is not open." So, as a test I open it manually which stops the error, but still no new records. I tried changing the "RecordSource" Property of the tables, but that didn't help.
Someone mentioned that RecordSets are the way to accomplish what I want to do, but I looked into them and they made my head spin.
Can someone recommend a course of action here?
Thanks!
Rich
Code:
Category Description Subtotal
-------- ---------------------------- ---------
BalanceFwd Previous Balance $1,000.00
BalanceFwd Amount Received 500.00
BalanceFwd Interest @ 1.5% per month 2.00
... ... ...
Code:
Public Sub pubAddRec(NewCategory, NewDescription, NewSubtotal)
DoCmd.GoToRecord , , acNewRec
Category = NewCategory
Description = NewDescription
Subtotal = NewSubtotal
End Sub
Code:
Form_subfrmInvoiceScratch.pubAddRec "Balance", "Previous Balance", "$1000.00"
Code:
DoCmd.GoToRecord acDataTable, "tblInvoiceScratch", acNewRec
Someone mentioned that RecordSets are the way to accomplish what I want to do, but I looked into them and they made my head spin.
Can someone recommend a course of action here?
Thanks!
Rich