How to display all data in a range with non-numerical criteria (2)

S

Sianboy

Here another similar question,

The database will show all car's particulars as long its registered date
matches the year inside the combo box of the form. For example, a car with
registered date of 1999 will be displayed once the user choose 1999 in the
combox box. The problem now is, what if the combo box got non-numerical
values like "<1 year(s) old" or <10 years(s) old". How am I going to display
cars with registration dates that fulfilled such criteria which is a range
and yet, possess non-numerical value.

Need help asap and the solutions provided should be simplied as non-sql user
here. Thanks!
 
A

Allen Browne

You have 3 things in one combo here:
- an operator (such as less than);
- a number
- the type of period.

You need to split these into 3 separate controls, or else write code that
deals with each individual case (a Select Case construct.)

The simplest example would be to have 3 controls:
- a combo box where the user choose from a list such as
"=", "<", "<=", ">=", "<>"
- a text box where the user enters a positive whole number
- a combo where the user selects the period type, such as:
"d", "m", "q", "yyyy"
The values for the last combo are expressions that are valid for DateAdd().

You can now write code to create a Filter or WhereCondition string, based on
the contents of these 3 controls.

If you don't know how to code such a string, here's an example to work with:
Search criteria
at:
http://allenbrowne.com/ser-62.html
It's a more generic example, but illustrates how to build up a filter
string.
 
S

Sianboy via AccessMonster.com

Ok sure thanks a lot I will go try out!

Allen said:
You have 3 things in one combo here:
- an operator (such as less than);
- a number
- the type of period.

You need to split these into 3 separate controls, or else write code that
deals with each individual case (a Select Case construct.)

The simplest example would be to have 3 controls:
- a combo box where the user choose from a list such as
"=", "<", "<=", ">=", "<>"
- a text box where the user enters a positive whole number
- a combo where the user selects the period type, such as:
"d", "m", "q", "yyyy"
The values for the last combo are expressions that are valid for DateAdd().

You can now write code to create a Filter or WhereCondition string, based on
the contents of these 3 controls.

If you don't know how to code such a string, here's an example to work with:
Search criteria
at:
http://allenbrowne.com/ser-62.html
It's a more generic example, but illustrates how to build up a filter
string.
Here another similar question,
[quoted text clipped - 10 lines]
user
here. Thanks!
 

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