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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Parameter disappears when report exported to MS Word

Status
Not open for further replies.

richf007

Programmer
Nov 2, 2003
9
0
0
US
Hi.

I was wondering if anyone has come across this issue in MS Access 2000 when exporting a report to MS Word 2002 (PC is running Windows XP with Service Pack 2):

Modules: form (frmRouteByDate), query (qryRouteByDate) and report (rptRouteByDate).

I have a form that allows the client to select a commuter bus route from a ComboBox, which is loaded with route numbers from a table (there are 6 routes). There is also a calendar control for selecting an "as of date". The "Preview Report" command button on the form opens a report in preview mode. Here's the print code from the command button's Click procedure:

' Print preview the Route By Date Report.
Dim stDocName As String
stDocName = "rptRouteByDate"
DoCmd.OpenReport stDocName, acPreview


The report's Record Source is a query, which selects records from a table based on the route number ([Forms]![frmRouteByDate].[cboRouteNbr]) and "as of date" ([Forms]![frmRouteByDate].[calAsOfDT]) selected by the client via the form. In the report's heading I print the route number (Control Source: =Forms!frmRouteByDate.cboRouteNbr) and "as of date" (Control Source: =Forms!frmRouteByDate.calAsOfDT) using the form field values selected by the client. The print preview of the report lists the selected route and "as of date" in the heading, so far so good...

When the report gets exported to MS Word, the route number and "as of date" do not come across, i.e. the fields are blank in the output Word document. I'm not sure why those two fields are not being exported. Everything else on the report gets exported correctly.

Many thanks in advance for any insight, ideas, comments, etc.

Rich
 
Hi.

I fixed the problem using a workaround solution. First, for the route number on the report I just used the RouteNumber from the table since the value returned by the query will equal the parameter value selected by the client (duh). For the "as of date", I created an expression named "AsOfDate" in the query to be equal to the form "as of date" selected by the client. Then for the "as of date" on the report I used the "AsOfDate" field from the query results. Now the report exports the route number and "as of date" to MS Word.

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top