VBA – Create Query with VBA

There are many ways to create a query in Access. However, creating a query with VBA code is something quite challenging. The code below creates an object of type query, named “MyQuery”. The SQL of the object is also given within the code. The result looks like this:
queryCreation

 

Thus, we have a new query, which is code-created. Quite interesting way of using the Data Access Objects (DAO) in Access.

Here come the few lines of code:

Enjoy it! 🙂

Tagged with: , , ,