queryDef with multiple parameters

G

Guest

I have a query ("qryTest"), within this query I have two parameter fields
(Destination & Origin).

I have a form where the user can select the Desination & Origin from a
drop-down box. When the hit my GO button it runs my code.

Here is the piece that isn't working right:

<>
Set qdf = db.QueryDefs("qrytest")
qdf.Parameters("Destination") = varDestCode3
qdf.Parameters("Origin") = varOrigin

--- It then outputs the varDestCode3 and varOrigin to excel
<>

My question is this...How do you set multiple parameters for 1 query. If I
take out the 'qdf.Parameters("Origin") = varOrigin' part it works fine with
one parameter.

Any ideas?
 
D

Dirk Goldgar

James C. said:
I have a query ("qryTest"), within this query I have two parameter
fields (Destination & Origin).

I have a form where the user can select the Desination & Origin from a
drop-down box. When the hit my GO button it runs my code.

Here is the piece that isn't working right:

<>
Set qdf = db.QueryDefs("qrytest")
qdf.Parameters("Destination") = varDestCode3
qdf.Parameters("Origin") = varOrigin

--- It then outputs the varDestCode3 and varOrigin to excel
<>

My question is this...How do you set multiple parameters for 1 query.
If I take out the 'qdf.Parameters("Origin") = varOrigin' part it
works fine with one parameter.

Any ideas?

I don't see what's wrong with what you've got, and you don't say in what
way it isn't working right. You're sure you've spelled the parameter
names correctly? What error message do you get?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top