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

S

Sianboy

Hey all, I a student who is doing a project for IT course now and non-sql
user, therefore the solutions suggested should be siimplified or minimal code
writing. Here the question.

I got a form that shows all details of a car as long its price is within a
range. For example, any car with values of $20,000 will be displayed within
the price range of $10,000 and $30,000. There are two combox box with values
in the form, first is starting range and second is the ending range. Now the
problem is, for the second combo box, there is a value called "No Max" in it,
which means it can go infinite. The problem is how to do a query that will
run such non-numerical value and display all cars with prices within the
range of starting price to no max.

A quick reply is appreciated thanks!
 
C

Clifford Bass

Hi,

Try something like this (untested), assuming you are doing it in code,
such as off the combo boxes's After Update events:

Dim strFilter As String

strFilter = "[Car_Value] >= " & [cbStartValue]
If [cbEndValue] <> "No Max" Then
strFilter = strFilter & " and [Car_Value] <= " & [cbEndValue]
End If
Filter = strFilter
FilterOn = True

Hope that helps,

Clifford Bass
 

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