Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Value from Access to Words

Status
Not open for further replies.

mahap

IS-IT--Management
Joined
Dec 2, 2001
Messages
2
Location
MY
I created a Form in Access 2000 with To, From and Date fields in it. I have Word template with a table consist To, From and Date columns with no field reference.

I want to pass these values from the Access Form to Words template. However, I haven't input any field reference in the template. Basically, I don't know how to do it.

What should I do to pass these values to Words by clicking an OK button after input the necessary details in Access.

Please help. Thank you very much for your assistance in advance.

With Regards,
Maha
 
OutputTo Action


You can use the OutputTo action to output the data in the specified Microsoft Access database object (a datasheet, form, report, module, data access page) to a file in Microsoft Excel 98 (*.xls), MS-DOS text (*.txt), or rich-text (*.rtf) format. You can also output to a file in HTML (*.html) format, to files in Microsoft Internet Information Server (*.htx, *.idc) format, or to a file in Microsoft Active Server (*.asp) format. Files in Microsoft Internet Information Server format can also be used with Microsoft Personal Web Server.

Setting

The OutputTo action has the following arguments.

Action argument Description
Object Type The type of object containing the data to output. Click Table (for a table datasheet), Query (for a query datasheet), Form (for a form or form datasheet), Report, Module, Data Access Page, Stored Procedure, or View in the Object Type box in the Action Arguments section of the Macro window. You can't output a macro. If you want to output the active object, select its type with this argument, but leave the Object Name argument blank. This is a required argument. The default is Table.
Object Name The name of the object containing the data to output. The Object Name box shows all objects in the database of the type selected by the Object Type argument.
If you run a macro containing the OutputTo action in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.
Output Format The type of format you want used to output the data. You can click HTML (*.html), Microsoft Active Server Pages (*.asp), Microsoft Excel (*.xls), Microsoft IIS (*.htx, *.idc), MS-DOS Text (*.txt), Rich Text Format (*.rtf), or Microsoft Data Access Page (*.html) in the box. Modules can be output only to MS-DOS text format. Data access pages can only be output in HTML format. Microsoft Internet Information Server and Microsoft Active Server formats are available only for tables, queries, and forms. If you leave this argument blank, Microsoft Access prompts you for the output format.
Output File The file you want to output the data to, including the full path. You can include the standard file name extension (.asp, .htm or .html, .htx, .xls, .txt, or .rtf) for the output format you select with the Output Format argument, but it's not required. If you output to Microsoft Internet Information Server or Microsoft Active Server files, Microsoft Access will always create files with the standard .htx and .idc or .asp file name extensions. If you output data access pages, Microsoft Access will always create files with .html file name extensions. If you leave the Output File argument blank, Microsoft Access prompts you for an output file name.
Auto Start Specifies whether you want the appropriate software to start immediately after the OutputTo action runs, with the file specified by the Output File argument opened. If you select Yes, one of the following starts with the output file from the Microsoft Access object opened: Microsoft Excel (for .xls files), Microsoft Windows Notepad (for .txt files), or Microsoft Word (for .rtf files). For .html files, your default Internet browser starts.
Template File The path and file name of a file you want to use as a template for .html, .htx, or .asp files. The template file is a file containing HTML tags.


Remarks

The Microsoft Access data is output in the selected format and can be read by any application that uses the same format. For example, you can output a Microsoft Access report with its formatting to a rich-text format document and then open the document in Microsoft Word.

If you output the database object to HTML format, Microsoft Access creates a file in HTML format containing the data from the object. You can use the Template File argument to specify a file to be used as a template for the .html file.

If you output the object to Microsoft Internet Information Server format, Microsoft Access creates two files:

An .idc file, which contains information on how to connect to an ODBC data source, and an SQL statement to execute against this data source. In this case, the Microsoft Access object you're outputting contains the data defined by the SQL statement and the current Microsoft Access database is the ODBC data source


An .htx file, which specifies how to format data returned from the SQL statement specified in the .idc file as an HTML document. You can use the Template File argument to specify a .html file to be used as a template for the .htx file.

Microsoft Internet Information Server uses the .htx and .idc files to create an .html file with the data in the Microsoft Access object you output.

If you output the database object to Microsoft Active Server format, Microsoft Access creates a file in .asp format that contains information on how to access and format the object's data. Microsoft Active Server uses the .asp file to create a .html file with the data in the Microsoft Access object you output. You can use the Template File argument to specify a .html file to be used as a template for the .asp file.

The following rules apply when you use the OutputTo action to output a database object to any of the output formats except Microsoft Active Server (some of these rules also apply to the Microsoft Active Server format):

You can output data in table, query, and form datasheets. In the output file, all fields in the datasheet look as they do in Microsoft Access, except fields containing OLE objects. The columns for these fields are included in the output file, but the fields are blank.


For a control bound to a Yes/No field (a toggle button, option button, or check box), the output file displays the value –1 (Yes) or 0 (No).


For a text box bound to a Hyperlink field, the output file displays the hyperlink for all output formats except MS-DOS text (in this case, the hyperlink is just displayed as normal text).


If you output the data in a form in Form view, the output file always contains the form's Datasheet view.


If you output the data in a report, the only controls that are included in the output file are text boxes (for .xls output files), or text boxes and labels (for .rtf, .txt, and .html output files). All other controls are ignored. Header and footer information is also not included in the output file. The only exception to this is that when you output the data in a report to a Microsoft Excel file, a text box in a group footer containing an expression with the Sum function is included in the output file. No other control in a header or footer (and no aggregate function other than the Sum function) is included in the output file.


Subreports are included in the output file, but subforms will be included when outputting to .asp, but only when outputting as a form (not a datasheet).


When you output a datasheet, form, or data access page in HTML format, one .html file is created. When you output a report in HTML format, one .html file is created for each page in the report.

For more information on rules and restrictions when outputting to .html files, see Export a datasheet to static HTML format and Export a report to static HTML format.

For more information on rules and restrictions when outputting to Microsoft Internet Information Server files, see Export a datasheet to dynamic HTML format and Export a form to dynamic HTML format.

For more information on rules and restrictions when outputting to Microsoft Active Server files, see Export a datasheet to dynamic HTML format, Export a form to dynamic HTML format, and Supported and unsupported form controls for dynamic ASP format.

Tip If you output the data in a report to an output file and the columns and rows of data in the output file don't align as in the report, the following tips may help:

You can point to Size on the Format menu, then click To Fit to size the controls.


You should avoid overlapping controls or placing controls too close together.


You can point to Align on the Format menu, then click the appropriate command to align the controls on the report. Controls that aren't aligned in the same row may be placed in separate rows in the output file, causing additional spacing.
The OutputTo action is similar to clicking Export on the File menu and selecting the Save Formatted check box in the dialog box that's displayed. The action arguments correspond to the settings in the Export dialog box. The Export command, however, applies only to the object selected in the Database window. By using the OutputTo action, you can specify the object you want to output.

Note You can output the selected data with the Export command. However, this functionality isn't available with the OutputTo action.

You can also point to Office Links on the Tools menu, then click Analyze It With MS Excel or Publish It With MS Word to output a database object, and open the output file immediately in Microsoft Excel or Microsoft Word.

To run the OutputTo action in Visual Basic, use the OutputTo method of the DoCmd object.
 
Hi all, Good day.

I have a Main Form (frmMain) and a Subform (frmSub). Both the forms needs user selection. My consent is the sub form. This subform consist of StockCode, Qty_Issued and Balance fields. This subform is data bound form. Whereby, the moment I enter the Qty_Issued, it will immediately minus the Balance and updates the StockMaster table.

I wish to make the update to take place once the user clicks OK to update. How to do this? I guess the RecordSet can help.

Please guide me.

Thanks,
Maha
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top