queryDef with multiple parameters

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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?
 
Back
Top