WiseOwl Training - Established 1992 Wise Owl Training

Established May 1992
30 years in business
Wise Owl Training
30 years in business
See 519 reviews for our classroom and online training
Linking to ADO databases with VBA
Part one of a five-part series of blogs

Learn how to write VBA macros to add, edit and delete data in Access, SQL Server and other databases, using something called ADO.

  1. Linking to Data using VBA (this blog)
  2. The ADO Object Library
  3. Of Connection Strings, Recordsets, Cursors and Locking
  4. Working with Records
  5. Finding Records Easily

This blog is part of both a complete Excel VBA tutorial and a complete SQL tutorial.

Posted by Andy Brown on 06 February 2012

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Linking to Data using VBA

Sometimes in Excel (for example) you'll need to retrieve data from a SQL Server table, an Access query or even a table in Oracle, Ingres or the like.  This blog explains how to do this!

This topic is stuffed full of theory about things like cursors and recordsets, but the strange thing is that the resulting code can be copied and pasted whenever you need to use it, without always needing to understand exactly what's going on behind the scenes! 

This tutorial shows how to connect to databases using VBA (we also offer classroom VBA courses).  It covers:

  • Linking to the correct object library
  • Some theory on connection strings, recordsets, cursors and locking
  • Writing code to show, add, edit and delete records
  • Finding records

The first thing you'll need to do to work with database records is to link to the ActiveX Data Objects library (called ADO by its friends).

This blog has 0 threads Add post