Excel VBA Introduction Part 30 – ADO (ActiveX Data Objects) Querying a Database
Connecting to databases in VBA sounds like it should be complicated, but using the ActiveX Data Objects, or ADO, Object Library makes life an awful lot easier! This video teaches you how to reference the library and how to create a connection to almost any type of database by providing the correct connection string (this video covers Microsoft Access and Microsoft SQL Server). We’ll also show you how to grab a set of data from a database using recordset objects and even how to write SQL queries in your VBA procedures. The final part of the video talks about how you can take user input to modify the query to allow you to create a simply querying tool in VBA.