Help

Re: MS Access VBA / Airtable Integration Available

2912 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Jon_Jaques
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello,

I’ve developed some Access VBA code which reads and writes to the Airtable API quite nicely using a module to parse the JSON.

My own use-case scenario is to generate printed labels with QR Codes and make sure that my base stays synchronized when new labels are printed, but the code could be developed to nearly any need, and most especially if you have an Access DB that needs to be uploaded to AT, this could would also work very well for that.

Are there others who would find this code useful to share?

Or, can I help anybody to convert their data for a reasonable fee?

Let me know!

–Jon

9 Replies 9
Gary_Audsley
4 - Data Explorer
4 - Data Explorer

If you could post the code JSON code which you used to connect to airtable, I am sure many people would be able to benefit from this and be able to produce some brilliant reports and documents.

I for one would be very interested in this.

Thanks
Gary

Stephen_Chapman
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Jon_Jaques. Do you have this code available? I’m looking to call Airtable data into an Excel spreadsheet.

Did you guys ever get this code ?
I have a Xamarin app that calls the API and it’s written in C# if you want to chat or share.

Jon_Jaques
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello!

Sorry I didn’t see this sooner, looks like my spam filter got ahold of it

In order to “talk JSON” from VBA/VBScript, you need a handy dandy parser object, I use this one:

http://www.aspjson.com

In one of my projects, I have a table called Assets. Here is the code to create an Asset record from within MS Access:

Public Function AddAsset(strDesc As String) As String
    Dim oj As New clsJSON, data, strOut As String, s As String
    Dim authnetStatus, authnetVal, xml, strURL As String
   ' On Error GoTo getAssetTags_Error
   On Error Resume Next
   
    strURL = "https://api.airtable.com/v0/123123/Assets" '  & strID '
    ' Debug.Print strURL

    Set oj = New clsJSON
    Set xml = CreateObject("Microsoft.XMLHTTP")
    xml.Open "POST", strURL, False
    xml.setRequestHeader("Content-type") = "application/json"
    xml.setRequestHeader("Authorization") = "Bearer key456456"
    
    oj.data.Add oj.Collection()
    oj.data.Add "fields", oj.Collection
    oj.data("fields").Add "Description", strDesc
    
    data = oj.JSONoutput
    xml.send data


    authnetStatus = CStr(xml.Status)
    authnetVal = xml.responseText
    
    AddAsset = authnetVal ' oj.JSONoutput '

   On Error GoTo 0
   Exit Function

getAssetTags_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure getAssetTags of Module modAirTables"
    
    
End Function

The trick to getting it to work as expected is in referencing and dereferencing the JSON object, but once you get the hang of it, it’s not too bad.

–Jon

Go change your key … you seem to have posted it in your response :slightly_smiling_face:
Can I ask what you are exchanging data with ?

Nope, you’ll see I posted 456456 for the key, and 123123 for the app id.

In the case of the function above, the database can create an Asset record in Airtable by passing only one value, strDesc.

The purpose of this particular little project was to print dymo labels for Assets in the database, complete with QR codes to lookup the Asset with.

Nice, I am integrating to make custom feature specific mobile apps that interface with Airtable …
Will be integrating with mobile printers later for barcode generation on demand but not sure which ones.

Joris_Steurs
4 - Data Explorer
4 - Data Explorer

Hi Jon,

Can you contact me?
josteurs@gmail.com
I see you wrote already some code that makes MS Office read from Airtable.
I’m in need of some VBA and I think you have 98% already at hand.
Obviously, any work you do I’ll pay for.

Hope to discuss this with you soon.

Thanks Joris

Jon_Jaques
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello Joris,

Check your inbox, I just sent you a message!

–Jon