Code listing for video:
Excel VBA to Extract Data from an Access Database

Description:
We will use an Access database as our data source.  We will add a button to an Excel spreadsheet to refresh the data in the spreadsheet.  Then we will embed Visual Basic for Applications (VBA) in the spreadsheet that will:
1.  Clear out data from previous executions of our code
2.  Query our source database
3.  Write the data we retrieve into our spreadsheet
4.  Keep track of how many rows of data we retrieved from the database
5.  Add two SUM formulas at the bottom of our data range
Note:  This is code we have put in our Excel spreadsheet – NOT the Access database.
Resulting spreadsheet:
ResultingSpreadsheet

Posted in Code Listings for Videos.