AcuODBC User's Guide
Version 6.0

4.1.1 Accessing Data From Word 97 and 2000

The following procedure describes how to access your COBOL data from Microsoft Word 97 and Word 2000, the word processing component of Microsoft Office 97 and Office 2000, respectively. If you have a different version of Word, use the procedures shown here to get an idea of the concepts involved in accessing COBOL data from within a Word document, but be aware that your steps may be slightly different.

  1. Start Microsoft Word and open the document into which you want to insert data.
  2. Select Mail Merge from the Tools menu. If your MS Office menus are set to "Show recently used commands first," you may need to click on the expansion arrows at the bottom of the Tools menu to see the Mail Merge option.
  3. The Mail Merge Helper dialog box appears.

  4. Under "Main Document," click Create and select Form Letters.
  5. Because you are already working in the document into which you want to insert data, click Active Window.
  6. You are then returned to the Mail Merge Helper dialog box

  7. Under "Data Source," click Get Data, and select Open Data Source.
  8. Click MS Query in the Open Data Source dialog box. (If you do not have an MS Query button, you will need to install MS Query on your machine.)
  9. This starts MS Query, and opens the Choose Data Source dialog box. If you want to use MS Query's "Query Wizard" to create your SQL query, leave the "Use Query Wizard" check box selected. Refer to MS Query's online documentation for instructions on using the Query Wizard.

    For simplicity, clear the Query Wizard.

  10. Select the DSN that corresponds to the data source you want to access and click OK. (Refer to section 3.1, "Data Source Names (DSNs)," for instructions on creating DSNs.) If you want to use the sample DSN that comes with AcuODBC, select AcuODBC Datasource.
  11. If you do not see your DSN listed, do one of the following:

  12. Select the table or tables that you want to add (for example, "clients"), and then click Add. Close the box when you're done.
  13. For each table you selected, a list box is displayed on the MS Query screen. This box lists all of the columns in the associated table.

  14. Double-click each column that you want to read into your Word document, and that column appears on the screen. If you want to add all columns, double-click the "*" at the top of the list box.
  15. If you prefer, you can populate the table by clicking the SQL button and entering and executing an SQL query.

    1. To enter an SQL statement, click SQL.
    2. In the SQL dialog box, type the SQL command you want to execute. Click OK when you're done. (For a description of the SQL commands supported by AcuODBC, refer to section 5.3, "SQL Syntax Supported by AcuODBC.")

    3. Note: If you click SQL to enter a query before, or rather than, performing Step 10, the dialog box opens with an empty entry field. If you click SQL after performing Step 10, the box opens with a query that reflects the selections you have already made.

  16. Select Return Data to Microsoft Word from the MS Query File menu. You are returned to your Word document.
  17. Click Edit Main Document to continue preparing your document. Notice that new mail merge buttons are added to the toolbar.
  18. Place the cursor in your document where you want to insert the data. Click Insert Merge Field to see a drop-down list of table columns. These are the columns that you selected in MS Query.
  19. Select the merge field you wish to insert. The control characters for this field are placed in your document.
  20. To display the data that corresponds to each field code, click the <<ABC>> button on the Mail Merge toolbar. Use the control buttons on the Mail Merge toolbar to scroll between records.
  21. Finish your document as you normally would. Whenever you want to insert a COBOL data field, click Insert Merge Field once again and select the appropriate field.
  22. Use the directional buttons on the Mail Merge tool bar to move to the next, previous, first, or last record in the table.

For more instructions on using Word's mail merge feature, refer to your Microsoft documentation.

Acucorp, Inc.
Voice: (800) 262-6585 (U.S.A. and Canada)
Voice: (858) 689-4500
Fax: (858) 689-4550

Please share your comments on this manual
or on any Acucorp documentation with the
Acucorp Communications Department.
1988-2003 Acucorp, Inc.
All rights reserved.