ACC: How to Use "<", ">", and "=" Operators in Query ParameterID: Q96463
|
Novice: Requires knowledge of the user interface on single-user computers.
This article describes how, without having to use code, you can enable a
user to type the comparison operators "<", ">", and "=" in query
parameters. It's best to keep the query criteria as simple as possible. For
more complex criteria, you must use Visual Basic or Access Basic code.
Table: Names
----------------------
Field Name: First Name
Data Type: Text
Field Name: Last Name
Data Type: Text
Field Name: Age
Data Type: Number
Field Size: Single
First Name Last Name Age
----------------------------
Tom Smith 35
Anne Howard 7
Jim Bowie 20
Sue Thomas 44
Query: List Names
--------------------------------------------
Type: Select Query
Field: First Name
Table: Names
Field: Last Name
Table: Names
Field: Age
Table: Names
First Criteria Line: =Mid([Enter Age],2)
Second Criteria Line: <Mid([Enter Age],2)
Third Criteria Line: >Mid([Enter Age],2)
Fourth Criteria Line: <leave blank>
Show: True
Field: Expr1:Left([Enter Age],1)
First Criteria Line: "="
Second Criteria Line: "<"
Third Criteria Line: ">"
Fourth Criteria Line: Is Null
Show: False
[Enter Age] Output
------------------------------------------
<leave blank> Tom Smith 35
Anne Howard 7
Jim Bowie 20
Sue Thomas 44
<21 Anne Howard 7
Jim Bowie 20
>21 Tom Smith 35
Sue Thomas 44
=7 Anne Howard 7
SELECT DISTINCTROW
[First Name], [Last Name], Age
FROM
Names
WHERE
(Age=Mid([Enter Age],2) AND Left([Enter Age],1)="=")
OR
(Age<Mid([Enter Age],2) AND Left([Enter Age],1)="<")
OR
(Age>Mid([Enter Age],2) AND Left([Enter Age],1)=">")
OR
(Left([Enter Age],1) Is Null)
Additional query words: greater less than
Keywords : kbusage QryParm
Version : 1.0 1.1 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 20, 1999