Another way would be to loop through my JSON file and pass each currency code & rate to a function that uses an SQL Query Qef to first locate the matching currency code and then update its rate.
/gustav Until you start dealing with 10's of thousands of records, doing record updating via DAO ! Add New The guts of it are at line 53 Sub 1 second for number of records Gustav, you already pointed me to that code in Call the CVRAPI using Java Script in one of my previous posts and there seems to be some great examples in there but I have already started using this code that seem to be doing the trick: So I was going to pass "key" which is the Currency Code and "po Dict(key)" which is the Currency Rate to a function that opens an SQL record set using "key" as the criteria to find the currency code, then update the currency Rate with "po Dict(key)" and the update.
But I of course would have to check to ensure there is a recordset before attempting to update.
Would I have to convert the rate from a variant to the Double data type (this is what the field is set for) before attempting to update or will it accept a variant?
If anyone feels that there would be a better way to do this or would like to suggest changes please feel free to share. m Json", db Fail On Error So no transaction is in order there Some error handling to catch invalid values in here For Each var Key In po Dict("rates"). So I've always built these kinds of things to create a recordset, do something, and close it within a loop.
Keys() '***Check var Key and po Dict("rates")(var Key) and lng Time Stamp for validity here '***and bail on this single addition if the JSON data was bad . Not a lot of bloat in the grand scheme of things As long as you don't trash/re-create your tables, you'll be fine.