AcuODBC User's Guide
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.
- Start Microsoft Word and open the document into which you want to insert data.
- 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.
The Mail Merge Helper dialog box appears.
- Under "Main Document," click Create and select Form Letters.
- Because you are already working in the document into which you want to insert data, click Active Window.
You are then returned to the Mail Merge Helper dialog box
- Under "Data Source," click Get Data, and select Open Data Source.
- 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.)
- In Word 2000, the MS Query button appears to the right of the "File name" text box.
- In Word 97, the MS Query button appears under the Cancel button on the right-hand side of the screen.
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.
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.
If you do not see your DSN listed, do one of the following:
- Click Browse and navigate to "c:\Program Files\Common Files\ odbc\DataSources", then double-click on the name of your DSN. This adds the DSN to the list in the Databases area of the Choose Data Source dialog box.
- Click Options and enter the path to the directory containing your DSN, then click Add. Now the contents of that directory will be listed in the Choose Data Source dialog box. For more information, see the MS Query documentation.
Select the table or tables that you want to add (for example, "clients"), and then click Add. Close the box when you're done.
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.
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.
If you prefer, you can populate the table by clicking the SQL button and entering and executing an SQL query.
- To enter an SQL statement, click SQL.
- 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.")
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.
Select Return Data to Microsoft Word from the MS Query File menu. You are returned to your Word document. Click Edit Main Document to continue preparing your document. Notice that new mail merge buttons are added to the toolbar. 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. Select the merge field you wish to insert. The control characters for this field are placed in your document. 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. 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.
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.
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.