I use the following code to copy data from one table (Fis_CaptureT) to another table (Fis_CaptDataT) in real time.
It works 100%, except when you make a typo, because that also gets copied then to the 2nd table.
I would like to do a batch transfer with a button called "PostData" of all the fields listed here on completion of an order, instead of in real time, to allow checking before copying of the order to the 2nd table.
Currently i open a form called "Fis_OrderEditF " shown below, if a duplicate record based on the "icn" field gets copied, and i can then edit the 2nd table there and then.
The batch must be based/filtered on
"Order_No"(numb erfield),
"Client_lookup" (numberfield)
and the "InvoiceDat e" (shortdate) fields
in the Fis_CaptureT table and
"Fis_StockOrder ingQ" query in the
subform called "Fis_OrderICNSF ".
The mainform is called "OrderFb2"
The Id field in "Fis_Captur eT' is called "Fis_CaptId "
please help
It works 100%, except when you make a typo, because that also gets copied then to the 2nd table.
I would like to do a batch transfer with a button called "PostData" of all the fields listed here on completion of an order, instead of in real time, to allow checking before copying of the order to the 2nd table.
Currently i open a form called "Fis_OrderEditF " shown below, if a duplicate record based on the "icn" field gets copied, and i can then edit the 2nd table there and then.
The batch must be based/filtered on
"Order_No"(numb erfield),
"Client_lookup" (numberfield)
and the "InvoiceDat e" (shortdate) fields
in the Fis_CaptureT table and
"Fis_StockOrder ingQ" query in the
subform called "Fis_OrderICNSF ".
The mainform is called "OrderFb2"
The Id field in "Fis_Captur eT' is called "Fis_CaptId "
Code:
Private Sub Form_AfterUpdate()
On Error GoTo Err_Form_AfterUpdate
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]
![InvoiceDate] = Me![InvoiceDate]
![Item_Lookup] = Me![Item_Lookup]
![CPrice] = Me![Price]
![Providers] = Me![Providers]
![Supplier] = Me![Supplier Lookup]
![Order_No] = Me![Order_No]
![DateReceive] = Me![DateReceive]
![OrderDate] = Me![OrderDate]
![ReceiveQty] = Me![ReceiveQty]
![OrderQty] = Me![OrderQty]
![DataCapturer] = Me![DataCapturer]
![Transact] = Me![Transaction]
![Order] = Me![Order]
![QtyReq] = Me![QtyReq]
![Stock_on_hand] = Me![Stock_on_hand]
![Comment] = Me![Comment]
![NewId] = Me![NewId]
![InvoiceQty] = Me![InvoiceQty]
.Fields("Transaction" & CStr(Me![Transaction])) = Me![InvoiceQty]
Rem ![Client_lookup] = DLookup("[ClientId]", "Client", "[Client_lookup] = '" & Me.Parent![Client_lookup] & "'")
.update
End With
rstEntry.close
Set rstEntry = Nothing
Exit_Form_AfterUpdate:
Exit Sub
Err_Form_AfterUpdate:
DoCmd.OpenForm "Fis_OrderEditF", acNormal, "", "[icn]=" & "" & Icn & "", , acNormal
Rem MsgBox Err.Description, vbExclamation, "Error in Form_AfterUpdate()"
Resume Exit_Form_AfterUpdate
End Sub