ACC: Exporting a Parameter Query to a Spreadsheet or Text FileID: Q124514
|
Moderate: Requires basic macro, coding, and interoperability skills.
NOTE: The problem described below does not occur in Microsoft Access
version 7.0. In version 7.0, exporting a parameter query causes the query
to prompt for input in the same way it normally would.
This article describes how to use the TransferText or TransferSpreadsheet
action in a macro to export a parameter query. (A parameter query is a
query that requires input in order to run.) You can export queries without
parameters using the TransferText or TransferSpreadsheet macro action using
the query's name for the action's Table Name argument. If you try to do
this with a parameter query, however, you receive the following error
message:
1 parameters were expected, but only 0 were supplied.
The following example demonstrates how to export a parameter query:
Function Find_City()
Find_City = Inputbox("Enter city name")
' You could also use "= [Forms]![Customers]![City]" with the
' assumption that the Customers form is open and that the City
' field contains a value.
End Function
Macro Name Action
--------------------------------
Macro1 TransferSpreadsheet
Macro1 Action
--------------------------------
TransferSpreadsheet
Transfer Type: Export
Table Name: Query1
File Name: C:\access\test.xls
For more information about the TransferText macro action, search for
"TransferText," and then "TransferText Action" using the Microsoft Access
Help menu.
For more information about the TransferSpreadsheet macro action, search for
"TransferSpreadsheet," and then "TransferSpreadsheet Action" using the
Microsoft Access Help menu.
Keywords : kberrmsg kbusage QryParm
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: April 8, 1999