Printer Friendly
The Free Library
6,683,052 articles and books
Member login
User name  
Password 
 
Join us Forgot password?

Click ... and the database loads into Excel: an easy way to import data into a spreadsheet.


If you're like most CPAs, you're more proficient with an Excel spreadsheet than a database. So when you're faced with the challenge of analyzing database information, you probably reluctantly bite the bullet and go through the tortuous steps of converting and importing it into Excel. Say good-bye to all that Good-bye to All That is the autobiography of Robert Graves.[1] First published in 1929, the work is a landmark anti-war memoir of life in the trenches during World War I. . We'll show you how to do the whole job with just a single mouse click.

Although we'll demonstrate the process with Microsoft Access A database program for Windows, available separately or included in the Microsoft Office suite. Access is programmable using Visual Basic for Applications (VBA). Access can read Paradox, dBASE and Btrieve files, and using ODBC, Microsoft SQL Server, SYBASE SQL Server and Oracle data. , you can use the same basic technique when converting from any ODBC (Open DataBase Connectivity) A database programming interface from Microsoft that provides a common language for Windows applications to access databases on a network.  (Open Database Connectivity See ODBC.

(standard, database) Open DataBase Connectivity - (ODBC) A standard for accessing different database systems. There are interfaces for Visual Basic, Visual C++, SQL and the ODBC driver pack contains drivers for the Access, Paradox, dBase, Text, Excel and Btrieve
) driver, including dBase, Visual FoxPro An Xbase development system for Windows from Microsoft. Originally known as FoxPro for Windows, FoxPro for DOS, etc., Visual FoxPro added object orientation and client/server support. Although FoxPro usage is on the decline, the language is highly regarded by the developers who use it. , Oracle and SQL Server An earlier relational DBMS from Sybase and from Microsoft. Sybase introduced SQL Server in 1988 for various Unix versions. In that same year, with help from IBM, Sybase created an OS/2 version that Microsoft licensed and branded as Microsoft SQL Server. . In addition, you'll be able to download a database's table, parts of a table or parts of a query. If you want to follow along as we proceed, download our demonstration Access file from www.aicpa.org/pubs/jofa/ sep2006/mahoney.mdb.

JUST A CLICK

Before you can automate the process, you'll need to go through the manual process just one time. Start by opening a new Excel workbook and clicking on the cell where you want the database information you will be downloading to begin. Then click on Data, Import External Data (exhibit 1, below) and select New Database Query.

[ILLUSTRATION OMITTED]

If a box pops up with the message Microsoft Excel (tool) Microsoft Excel - A spreadsheet program from Microsoft, part of their Microsoft Office suite of productivity tools for Microsoft Windows and Macintosh. Excel is probably the most widely used spreadsheet in the world.

Latest version: Excel 97, as of 1997-01-14.
 can't start MSQuery. This feature is not installed, would you like to install it now? click on Yes and follow the screen instructions.

Once you install MSQuery, again click on Data, Import External Data, New Database Query to open the Choose Data Source dialog box A movable window that is displayed on screen in response to the user selecting a menu option. It provides the current status and available options for a particular feature in the program.  (exhibit 2, page 54).

[ILLUSTRATION OMITTED]

Click on the Databases tab and select the format of your database. Our demo uses MS Access Database. If your database product doesn't appear, click on Browse to locate it on your computer and then click on OK, engaging the Select Database dialog box (exhibit 3, page 54). If you need to create a data source from a database that is not listed in this tab, click on <New Data Source> and follow the instructions.

[ILLUSTRATION OMITTED]

Navigate to the location of the target database (under Directories: c:\) and then, under Database Name, click on demonstration.mdb and on OK to open the Query Wizard--Choose Columns dialog box (exhibit 4, page 54).

[ILLUSTRATION OMITTED]

Select the information you want in the Query Wizard--Choose Columns dialog box by scrolling down the Available To help readers follow the instructions in this article, we use two different typefaces This is a list of typefaces. Serif
Here you can find a graphical version of this table.
  • Aldus
  • Antiqua
  • Aster
  • Baskerville
  • Bell (Monotype) Didone classification serif type deisgned by Richard Austin, 1788
  • Bembo
  • Benguiat
: Boldface type is used to identify the names of icons, agendas and URLs. Sans serif Short horizontal lines added to the tops and bottoms of traditional typefaces, such as Times Roman. Contrast with sans-serif.

 type shows the names of files and the names of commands and instructions that users should type into the computer tables and columns box. If you can't find the data, then click on Options to reveal the Table Options dialog box (exhibit 5, below).

[ILLUSTRATION OMITTED]

Then click in the Views checkbox (queries are called Views in Access) and click on OK. Now you should see both tables and queries in the Available tables and columns box. Click on what you want to download. In our example, the information we want is qrySalesbyCustomer. Clicking on its > button transfers all available fields to the Columns in your query box. If you don't want to download all the fields in the query or table, click on the + (plus) box to the left of the query or table and all the fields will appear. Click on each field you want, one at a time, and then click on the > button. When done, click on Next and the Query Wizard--Filter Data dialog box will appear (exhibit 6, below).

[ILLUSTRATION OMITTED]

There you can select criteria for table/query records by clicking on your choice in the Column to filter box and then select an option under Only include rows where. We won't do a filter in our example so click on Next, opening the Query Wizard--Sort Order box (exhibit 7, page 55). Choose the name of the column(s) you want to sort in the Sort by box and click on either the Ascending or Descending button. In our example we want to sort the data in ascending order by the LastName column.

[ILLUSTRATION OMITTED]

Finally, click on Next, opening the Query Wizard--Finish dialog box (exhibit 8, below).

[ILLUSTRATION OMITTED]

Accept the default option button, Return Data to Microsoft Office Microsoft's primary desktop applications for Windows and Mac. Depending on the package, it includes some combination of Word, Excel, PowerPoint, Access and Outlook along with various Internet and other utilities.  Excel, and click on Save Query, which opens the Import Data dialog box (exhibit 9, below).

[ILLUSTRATION OMITTED]

Choose the Excel worksheet and the cell in which you want the data displayed. In this example we accept the default position of Sheet cell A1 and click on OK.

Your data are now in your Excel spreadsheet as shown in exhibit 10, below. If you want to return the data to a different location in that worksheet, type the cell address in the text box. If you want to import to another worksheet, click on New worksheet.

[ILLUSTRATION OMITTED]

GOING ON AUTO

Now we're ready to automate the process with a macro. Put your cursor inside the contents of the database query in your spread sheet; that should cause the External Data toolbar A row or column of on-screen buttons used to activate functions in the application. Many toolbars are customizable, letting you add and delete buttons as required. Toolbars may be fixed in position or may float, which means they can be dragged to a more convenient location in the  to pop up (exhibit 11, page 56).

[ILLUSTRATION OMITTED]

If it doesn't appear, click on View, Toolbars and External Data (exhibit 12, page 56).

[ILLUSTRATION OMITTED]

Now let's record the macro. Select an Excel cell on the same sheet outside the database query range--such as H 10. (If you fail to do this, and your cursor happens to be inside the data range, the macro won't work properly) Then turn on the macro recorder A program routine that converts menu selections and keystrokes into a macro. A user turns on the recorder, calls up a menu, selects a variety of options, turns the recorder off and assigns a key command to the macro. When the key command is pressed, the selections are executed.  by clicking on Tools, Macro and Record New Macro, engaging the Record Macro dialog box (exhibit 13, page 56).

[ILLUSTRATION OMITTED]

Select a name (AutomaticUpdate) for the macro and type it in the Macro Name box and click on OK. That should engage the Stop Recording toolbar. Don't worry if it doesn't; there are others ways, which we'll describe later, to turn off the recording.

Select a cell in the database query range, such as BS, and click on the Refresh button (orange exclamation point exclamation point: see punctuation.

exclamation point - exclamation mark
) on the External Data toolbar (exhibit 11) and on the Stop button on the Stop Recording toolbar. If the toolbar doesn't pop up, do one of the following: Select either Tools, Macro, Stop Recording or View, Toolbars and Stop Recording. Then click on Stop.

ALMOST DONE

Now that we've recorded a macro, we need to attach it to a button in the spreadsheet. Though any type of button will work, we'll add one from Excel's Forms toolbar. Click on View, Toolbars, Forms (exhibit 14, below). Left-click on the button (it's circled) and then release it.

[ILLUSTRATION OMITTED]

Now move your cursor to where you want to place the button, left-click and hold down the mouse button as you draw the button icon to the size you want and release the mouse button. The Assign Macro dialog box (exhibit 15, below) will pop up. Click on the name of the macro you created (in this case AutomaticUpdate) and on OK. You have successfully attached the macro to the button. If you want to change the default label shown on the button, right-click over the button and edit the text label.

[ILLUSTRATION OMITTED]

Finally, to test the macro, go back to your original database and add some records. Then return to your spreadsheet and click on the new button. If you followed all the steps, the new records, as well as the old ones, will appear in your spreadsheet automatically

Although it took many setup steps, now you can save loads of time by updating your spreadsheet with new database information with just one click.

Key to Instructions

To help readers follow the instructions in this article, we use two different typefaces: Boldface type is used to identify the names of icons, agendas and URLs.

Sans Serif type shows the names of files and the names of commands and instructions that users should type into the computer.

Lois S. Mahoney, CPA (Computer Press Association, Landing, NJ) An earlier membership organization founded in 1983 that promoted excellence in computer journalism. Its annual awards honored outstanding examples in print, broadcast and electronic media. The CPA disbanded in 2000. , PhD, CMA CMA - Concert Multithread Architecture from DEC. , is an assistant professor at Eastern Michigan University Eastern Michigan University, mainly at Ypsilanti, Mich.; coeducational; founded 1849 as a normal school, became Eastern Michigan College in 1956, gained university status in 1959. , Ypsilanti. Her e-mail address See Internet address.

e-mail address - electronic mail address
 is lois.mahoney@emich.edu. Judith K. Welch, CPA, PhD, is an associate professor at the University of Central Florida “UCF” redirects here. For other uses, see UCF (disambiguation).
UCF is a member institution of the State University System of Florida. UCF was founded in 1963 as Florida Technological University with the goal of providing highly trained personnel to support the Kennedy
 in Orlando. Her e-mail address is jwelch@mail.ucf.edu.
COPYRIGHT 2006 American Institute of CPA's
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2006, Gale Group. All rights reserved. Gale Group is a Thomson Corporation Company.

 Reader Opinion

Title:

Comment:



 

Article Details
Printer friendly Cite/link Email Feedback
Author:Welch, Judith K.
Publication:Journal of Accountancy
Date:Sep 1, 2006
Words:1371
Previous Article:Rating 529 college savings plans: use Morningstar ratings to determine the long-term performance of these programs.
Next Article:Account reconciliation: an underappreciated control: this procedure has become even more important since Sarbanes-Oxley's passage.
Topics:



Related Articles
Electronic business tool. (spreadsheet software) (includes an article on personal information management systems) (Buyers Guide)
Spreadsheets: faster, smarter.
The power of spreadsheets. (software programs)
Add perspective to spreadsheets.(information analysis by CPAs using spreadsheet software)
Drilling for information.(computerized financial reports)
The automated spreadsheet.(how to use Microsoft Excel software to search for data; e-mail)
FILEMAKER PRO 5.5 COMPLETES SUITE FOR MAC OS X.
Ferret out spreadsheet errors: use Excel's tools to uncover and correct formula problems.
Technology Q&A.
Finding the cubic footage of your shipment.(Logistics Management...)

Terms of use | Copyright © 2009 Farlex, Inc. | Feedback | For webmasters | Submit articles