set query parameters with no prompt

kevcri

Registered User.
Local time
Today, 17:44
Joined
May 9, 2004
Messages
11
I need to use DoCmd.TransferText to output the results of a query. The query has 2 parameters that need to be set in order to run. I set them using the following

Set qdf = CurrentDb.QueryDefs("OptedOut")
qdf.Parameters("low") = "A"
qdf.Parameters("hi") = "Z"

and when I get the transfer text part of the program a prompt comes up asking for the values of the parameters. what do I do to prevent the prompt?

thanks
Kevcri
:confused:
 
You have to loose the parameters.
Code:
dim qdf as querydef
set qdf = currentdb.querydefs("OptedOut")
qdf.sql = replace(replace(qdf.sql,"low", "A"), "hi", "Z")
Now run the report.

Note that the definition of the query was changed!
 
I need to use DoCmd.TransferText to output the results of a query. The query has 2 parameters that need to be set in order to run. I set them using the following

Set qdf = CurrentDb.QueryDefs("OptedOut")
qdf.Parameters("low") = "A"
qdf.Parameters("hi") = "Z"

and when I get the transfer text part of the program a prompt comes up asking for the values of the parameters. what do I do to prevent the prompt?

thanks
Kevcri
:confused:

What Guus said. Or, you can have the query be a make-table query that outputs the results into a table and then TransferText from the table.
 

Users who are viewing this thread

Back
Top Bottom