Jso n.. (VBA Access)

arian29

Board Regular
Joined
Sep 12, 2011
Messages
64
Can check the code.. its not working :(

Sub doParse()
Dim valKey
Dim keyName
Dim TKeyName
Dim UKey
Dim Keys() As String
Dim lCtr As Long
Dim r As Long
Dim KeyCtr As Long
Dim JsonObject As Object
Dim JSonString As String
Call InitScriptEngine

Dim db As Database
Dim rs As Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset("Select * from Account where CHID=4307577")

Do Until rs.EOF

Set JsonObject = DecodeJsonString(rs("DueDilResponse"))
Keys = GetKeys(JsonObject)

rs.Edit
For lCtr = LBound(Keys) To UBound(Keys)
keyName = Keys(lCtr)
Debug.Print keyName
valKey = GetProperty(JsonObject, keyName)

For a = 0 To rs.Fields.Count - 1
If rs.Fields(a).Name = keyName Then
rs(a) = valKey
Debug.Print rs.Fields(a).Name & "Found"
End If
Next
Next

rs.Update
rs.MoveNext
Loop
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,
You are not using native VBA objects so no way to debug from the information provided. Often the best advice is to step through your code.
See <a href="http://krgreenlee.blogspot.com/2006/04/programming-excel-vba-debugging-for.html">Step through your code</a> for debugging tips.

ξ
 
Upvote 0

Forum statistics

Threads
1,221,904
Messages
6,162,744
Members
451,785
Latest member
DanielCorn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top