Form query criteria

Spelthorne1

Registered User.
Local time
Today, 07:15
Joined
Feb 17, 2004
Messages
20
Ive got a db that has a form that will hopefully control the queries.

The value Yes needs to be in the criteria for certain columns. I would like a select button on the form to acheive this.
Therefore, in the onclick event for the select button ive:

If selectbutton.value = -1 then
criteria = "Yes"
else Criteria = "No"
end if

When the select box is ticked criteria = Yes. How do i get this value into the qurey criteria section.
Ive tried
[Form]![Form1]![criteria.text] but when the query is run it says you cancelled the query.

thanks
 
Code:
If selectbutton.value = -1 then
criteria = "Yes"
else Criteria = "No"
end if

can be changed to:

Code:
Criteria = IIf(Selectbutton, "Yes", "No")

[Form]![Form1]![criteria.text]

should be changed to:

[Forms]![Form1]![criteria]
 
thanks ive got that working fine now but...

I forgot to mention that there are a number of columns whos values are yes/no.
I tried the:

Criteria = IIf(Selectbutton, "Yes", "No")

and the:

[Forms]![Form1]![criteria]

but substituting numbers after the name, Criteria1,2 etc and Selectbutton, but none of these work now!
I can either get all yes from one column but not yes' from a number of them!
Any suggestions?
 

Users who are viewing this thread

Back
Top Bottom