R
Rover
I have a form that reads a table (DynSetIN) and parses the data and
writes multiple records out to two keyed tables (DynSetOut1 and
DynSetOut2). The problem I'm having is: if I get a duplicate key error
(3022) I want to add the invoice amounts (the key is invoice number).
I'm not sure how to do that.
I know I should Edit then Update but in all my attempts is says "No
current record. Do I have to do this in multiple passes?
=======================
<snip>
Set dynSetIN = dbs.OpenRecordset(AcctRecSet, dbOpenDynaset)
Set dynSetOut = dbs.OpenRecordset("Invoice", dbOpenDynaset)
Set dynSetOutPay = dbs.OpenRecordset("Payments", dbOpenDynaset)
With dynSetOut
dynSetIN.MoveFirst
Do Until dynSetIN.EOF
If Not IsNull(dynSetIN![App# 1 date]) Then
.addNew
!InvoiceNo = dynSetIN![Inv# No# 1]
!invoicePrintDate = dynSetIN![App# 1 date]
!AppType = "app1"
!Amt = Nz(dynSetIN![Amount 1]) + Nz(dynSetIN![Bal 1])
'=== I'm missing the tax % and Tax amount
.Update ' Invoce table
end if
<snip>
=============================
writes multiple records out to two keyed tables (DynSetOut1 and
DynSetOut2). The problem I'm having is: if I get a duplicate key error
(3022) I want to add the invoice amounts (the key is invoice number).
I'm not sure how to do that.
I know I should Edit then Update but in all my attempts is says "No
current record. Do I have to do this in multiple passes?
=======================
<snip>
Set dynSetIN = dbs.OpenRecordset(AcctRecSet, dbOpenDynaset)
Set dynSetOut = dbs.OpenRecordset("Invoice", dbOpenDynaset)
Set dynSetOutPay = dbs.OpenRecordset("Payments", dbOpenDynaset)
With dynSetOut
dynSetIN.MoveFirst
Do Until dynSetIN.EOF
If Not IsNull(dynSetIN![App# 1 date]) Then
.addNew
!InvoiceNo = dynSetIN![Inv# No# 1]
!invoicePrintDate = dynSetIN![App# 1 date]
!AppType = "app1"
!Amt = Nz(dynSetIN![Amount 1]) + Nz(dynSetIN![Bal 1])
'=== I'm missing the tax % and Tax amount
.Update ' Invoce table
end if
<snip>
=============================