I use the following code to append individual records from the "Fis_Captur eT" table, to the "Fis_CaptDa taT" in realtime per row. It works 100%, until i correct an error in the "OrderQty" field, in the "Fis_Captur eT" table.
My question - how can i change the "OrderQty" in the
main capturing table - " Fis_CaptureT" and then it updates this same record in realtime in the 2nd table - "Fis_CaptDataT" , without creating another record when changing it.
mainform = OrderingF
subform = Fis_OrderICNSF
field = OrderQty in both tables
main table = Fis_CaptureT
2nd table = Fis_CaptDataT
[Fis_CaptID] appears in both tables, and is set for "no duplicates allowed" in both
I imagine it has to do with edit+update in the recordset. But how do i adjust the above code to incorporate this?
Currently i get around this by using the following code
The code is situated in the "error trapping" part of the main recordset append code at the bottom, and if a duplicate of the same ID gets appended due to a change in the "OrderQty" and it getting appended, it kicks in.
I open a 2nd form in the background containing the Fis_CaptDataT table, update the specific field using the afterupdate function and closing it again immediately. Is there a better way using recordsets?
Please help. I have struggling for 2 days non-stop now.
Code:
Dim MyDB As DAO.Database
Dim rstEntry As DAO.Recordset
Set MyDB = CurrentDb
Set rstEntry = MyDB.OpenRecordset("Fis_CaptDataT", dbOpenDynaset, dbAppendOnly)
With rstEntry
.AddNew
![Client_lookup] = Me![Client_lookup]
![Item_Lookup] = Me![Item_Lookup]
![CPrice] = Me![Price]
![Order_No] = Me![Order_No]
![OrderDate] = Me![OrderDate]
[B]![OrderQty] = Me![OrderQty][/B]
![InvoiceQty] = Me![InvoiceQty]
.Fields("Transaction" & CStr(Me![Transaction])) = Me![InvoiceQty]
![Fis_CaptID] = Me![Fis_CaptID]
.update
End With
rstEntry.close
Set rstEntry = Nothing
main capturing table - " Fis_CaptureT" and then it updates this same record in realtime in the 2nd table - "Fis_CaptDataT" , without creating another record when changing it.
mainform = OrderingF
subform = Fis_OrderICNSF
field = OrderQty in both tables
main table = Fis_CaptureT
2nd table = Fis_CaptDataT
[Fis_CaptID] appears in both tables, and is set for "no duplicates allowed" in both
I imagine it has to do with edit+update in the recordset. But how do i adjust the above code to incorporate this?
Currently i get around this by using the following code
Code:
DoCmd.OpenForm "Fis_OrderEditF", acNormal, "", "[Fis_CaptID]=" & "" & Fis_CaptID & "", , acNormal [Forms]![Fis_OrderEditF]![OrderQty] = [Forms]![OrderingF]![Fis_OrderICNSF]![OrderQty] [Forms]![Fis_OrderEditF]![InvoiceQty] = [Forms]! [Forms]![Fis_OrderEditF].Requery DoCmd.close acForm, "Fis_OrderEditF"
I open a 2nd form in the background containing the Fis_CaptDataT table, update the specific field using the afterupdate function and closing it again immediately. Is there a better way using recordsets?
Please help. I have struggling for 2 days non-stop now.
Comment