Parameters in a query in run time

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
 
D

Duane Hookom

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.
 

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

Top