VBA – Using Parameters in a VBA SQL Query To a Database

In this article I will simply use the code from my first guest author Mathieu, to build up some small working solution, that uses parameters:

So, the two classes, provided by Mathieu are here as well  GitHub, named AdoValueConventer.cls and SqlCommand.cls. These are used to make the following query from the code below:

So, what is the idea of the code?

It creates5 entries to a database, consisting of 4 columns – ID, Invoice Date, AccountType and CompanyName. ID is autoincrementable Primary Key, so it is automatically generated. The sample data is generated through a loop:

The Account class, is the one which is responsible to hold the data. The invoiceCollection consists of Account Objects:

Once the data is generated, we pass the invoiceCollection to a database, using the two classes (referred in GitHub):

And this is how it sends 5 sql transactions to our LocalDb.

About

A VBA Developer.

Tagged with: , , ,