Parameters in a query in run time

  • Thread starter Thread starter Nuno Gomes
  • Start date Start date
N

Nuno Gomes

Hello all,


Let's assume i have the next query:
SELECT * FROM CUSTOMERS WHERE CUST_NUM=[Enter the customer number?]
in the querys tab, and named QUERY_CUST


Now, in a form in a click event button, i have the code:
Dim rst as Recordset
Dim StrSQL

StrSQL="SELECT * FROM QUERY_CUST"
Set rst=Codedb.OpenRecordset(StrSQL)
....

When i click in the button it came a message where say "Error 3061"; "Few
parameters: 1 waited"

I already define the parameter in que query design view.

How i solve the situation?



Thanks,

Nuno Gomes
 
I wouldn't use a parameter. Just build the entire SQL statement and assign it
to strSQL. The strSQL should have no parameters or references to controls on
forms.
 
Back
Top