Operators and Drop Down

  • Thread starter misschanda via AccessMonster.com
  • Start date
M

misschanda via AccessMonster.com

Hello,
I have a subform that queries based off selection in main form.

One of the fields on the main form has a combo box with a list of operators:
=, >,<, <=, >= that should be used in conjunction with the text box [size].

I seen this down in a similar database
using the following:

((IIf([Forms]![Main Form]![cboOperator] Is Null Or [Forms]![Main Form]!
[txtAge] Is Null,True,IIf([DateOfbirth] Is Null,Null,Eval(DateDiff("yyyy",
[DateOfBirth],Date())+(Format(Date(),"mmdd")<Format([DateOfBirth],"mmdd")) &
[Forms]![Main Form]![cboOperator] & [Forms]![Main Form]![txtAge]))))=True)

Unlike the above text box [size] doesn't need to be calculated to get a value.
Nonetheless, I am unsure of how to manipulate to fit my needs.

Thanks

LA
 
A

Allen Browne

You cannot use an operator as a parameter in query.

You will need to build the query (or filter) string dynamically. Here's an
example of building such a search string:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

While the example doesn't actually use a combo for the operator, you should
be able to see how to concatenate the value of the combo into the string as
an operator.
 

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