I want to have all the data in the open subform to be part of my JSON string. Currently, only the first row is picked up. I want all current rows to be picked up after pressing the save
button.
The parent form data is properly picked up, it's just this part on the subform which is incomplete: it's only picking the first-row data, the second-row data through the last is not picked up.
I want the first row of data to the last to be picked up after pressing the save
button from the subform called [sfrmInvoicedetails Subform]
Private Sub CmdSales_Click()
Dim rs As Recordset
Dim foo As New Dictionary
Set foo = New Dictionary
Dim Noor As Dictionary
Set Noor = New Dictionary
Dim hoo As New Collection
Dim goo As New Dictionary
Set goo = New Dictionary
Dim Zoo As New Dictionary
Set Zoo = New Dictionary
Dim Koo As New Collection
Dim Too As New Collection
Set rs = Me.[sfrmInvoicedetails Subform].Form.RecordsetClone
With rs
Do While Not .EOF
'Do Something
.MoveNext
Loop
End With
Set rs = Nothing
With foo
.Add "PosSerialNumber", Me.INV
.Add "IssueTime", Me.InvoiceDate
.Add "Customer", Me.Customer.Column(1)
.Add "TransactionTyp", 0
.Add "PaymentMode", 0
.Add "SaleType", 0
.Add "Items", Koo
Koo.Add Noor
Noor.Add "ItemID", 1
Noor.Add "Description", Forms!frmInvoice![sfrmInvoicedetails Subform]!Description.Column(1)
Noor.Add "BarCode", "4589630036"
Noor.Add "Quantity", Forms!frmInvoice![sfrmInvoicedetails Subform]!Qty
Noor.Add "UnitPrice", Forms!frmInvoice![sfrmInvoicedetails Subform]!UnitPrice
Noor.Add "Discount", Forms!frmInvoice![sfrmInvoicedetails Subform]!Discount
Noor.Add "Taxable", hoo
hoo.Add Forms!frmInvoice![sfrmInvoicedetails Subform]!Taxables
Noor.Add "Total", 120
Noor.Add "IsTaxInclusive", Forms!frmInvoice![sfrmInvoicedetails Subform]!Inclusive
Noor.Add "RRP", Forms!frmInvoice![sfrmInvoicedetails Subform]!RRP
End With
Dim member As Variant
For Each member In foo
Next
MsgBox JsonConverter.ConvertToJson(foo, Whitespace:=3), vbOKOnly, "Audited by Chris H"
End Sub
Full data rows picked from the recordset of the subform called [sfrmInvoicedetails Subform]
and show in the JSON string