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



The criteria is used to obtain customer information based on priority level.
Currently the each customer has a priority number from 1 to 10. I'm setting
up a form that has a textbox where the user can specify if they want to pull
records that are defined such as "1" "2" etc... or if they want to obtain
customers who are a priority level of "<4". This is why I want to add
conditional statements to my query. I thought I could use vba to run an SQL
statement to do this but that did not work based on the string operations
that I was allowed. If you can direct me in another direction that would be
great.

Marshall Barton 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
[quoted text clipped - 4 lines]
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.


--
http://www.geocities.com/ngl1145/Sig.jpg

.



Relevant Pages

  • Re: access 2003
    ... of the combo boxes which is either ChooseCust or ChooseJob. ... except for Job in place of Choose this query creates the PreBilling report ... both criteria values that are coming from the combo boxes into the query. ... when you remove the criteria for the Customer and Job fields, ...
    (microsoft.public.access.conversion)
  • Re: requery vs. refresh vs. Remove Filter/Sort
    ... > to show specific department employees in the criteria drop-downs. ... > Row Source of Customer Combobox: ... > in the query pulling from these 7 separate unbound controls. ... But the control reference in your query criterion is to ...
    (microsoft.public.access.formscoding)
  • Re: searching for similar records
    ... "John Spencer" wrote: ... anything at all with criteria or joins on partnumber. ... should only the partnumber and customer be ... Open a new query ...
    (microsoft.public.access.queries)
  • Re: searching for similar records
    ... "John Spencer" wrote: ... anything at all with criteria or joins on partnumber. ... should only the partnumber and customer be ... Open a new query ...
    (microsoft.public.access.queries)
  • Re: searching for similar records
    ... "John Spencer" wrote: ... anything at all with criteria or joins on partnumber. ... should only the partnumber and customer be linked? ... Open a new query ...
    (microsoft.public.access.queries)