Re: Help with using form text box to change a query criteria



ngl1145 wrote:
I think I need some help from some of you. I created a simple query
where it looks at the textbox in my form as it's criteria. For example in my
query, I typed "=[Forms]![Form1]![Text0]". When I click the run query button
and I enter a set value.. say "10", the query will retrieve any records that
have "10" in the column which is great. But when I put a "<10" in the
textbox and I run the query, it gives me a "You canceled the previous
operation" message box. Is there a way I can use the Form textbox to run
conditional criteria like "<10"?


No. The < needs to be in the query instead of the =
Generally, the text box can only contain a value (e.g. 10),
it can not be used to specify the comparison operator.

If you absolutely must allow users to specify the
comparison, you will need to use a different approach where
you use VBA code (probably using the BuildCriteria function)
to construct the query. Since you didn't say anything about
how the query is going to be used, I can't realistically
suggest anything more specific than that.

--
Marsh
MVP [MS Access]
.


Loading