Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Pulling Access Information into Excel.
by Allen Wyatt
(last updated February 23, 2015)
Moss built an Access database of his customers, and he uses Excel for the invoicing. He wonders if there is a way to populate the customer information fields in the Excel invoice automatically from the Access database.
There are a few ways you can approach this task, and each method has plusses and minuses. A relatively simple approach is (obviously) to forego Excel altogether and simply do everything in Access. Simple invoices could be created using forms, and then your data doesn't need to travel between programs.
If you prefer to do the invoice in Excel, then you could create a link in Excel to a query in Access. You create a new query by choosing Data | Import External Data | New Database Query. This starts a Wizard that asks you questions about what you want to import. By selecting the database, the table, and the column of data you require via the options in the Wizard, Excel pulls all the Access records into the worksheet and will automatically update (re-populate) the information each time the workbook opens. You can then, within Excel, access the imported information using formulas that utilize various lookup functions.
Another approach is to develop your own set of VBA macros to grab the information from the Access database. This is not a trivial task, as it involves knowing how to access, via VBA, objects in both Excel and Access. You'll also need to know how to put together SQL statements to extract only the data you want from the database. The upside of slogging through creating the macros is that they provide the most flexibility possible in grabbing data and manipulating it.
Creating the exact macros you need is beyond the scope of this simple tip. You can find more information by getting a few good VBA programming books (make sure you get one specifically for Access as one of the books). The websites available at the Access MVP site may also be helpful:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11842) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Pulling Access Information into Excel.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
When importing Excel information into Access, you need to be concerned with the condition of the data. Here's how to make ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.