VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.8k stars 575 forks source link

VBA Returning an error while trying to Post data to Json #142

Closed nectorprime closed 5 years ago

nectorprime commented 5 years ago

The code below giving error runtime 3061, expected1

Private Sub CmdSales_Click() Dim d As New Dictionary, c As New Collection Dim http As Object Dim db As Database Dim rs As Recordset Set db = CurrentDb Dim JSON As Object Dim i As Integer Dim strSQL As String Dim item As Object strSQL = "SELECT * FROM [Qry1] WHERE [Qry1.INV] = " & Me.CboInv Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges) http.Open "POST", "http://jsonplaceholder.typicode.com/customers/?id=" & Me.CboInv, False http.send Set JSON = ParseJson(http.responseText) i = 2 For Each item In rs d.Add "INV", "INV" d.Add "Customer", "Customer" d.Add "TaxId", "TaxId" d.Add "Address", "Address" d.Add "InvoiceDate", "InvoiceDate" d.Add "Product", "Product" d.Add "Qty", "Qty" d.Add "Price", "Price" d.Add "VAT", "Vat" d.Add "TotalPrice", "TotalPrice"

Next Dim jsonStr As String jsonStr = ConvertToJson(c) End Sub

I want to post the attached list in the code to link below:

http://jsonplaceholder.typicode.com/customers/