Lindsay Smith
|
| Posted: 01/09/2003, 8:37 AM |
|
I would like to have a price range search option on my page. I have read and done all the tutorals about events and such that deal with date range. But the price range is only one field so can some one help me out I am kinda frustrated and not sure which way I am supposed to do for this project I am working on.
Thank you in advance
Lindsay Smith
Dorkrina@hot.rr.com
|
|
|
 |
RonB
|
| Posted: 01/10/2003, 4:45 PM |
|
you didn't state the databse you are using so I'm assuming MySql but the sql is fairly standard so should be applicable to other databases.
first create a search grid with two textfields.Let's call em low and high
The grid containing the prices needs to be adjusted. Switch from table to sql. In the sql window type something like the following:
select bla, blabla, price from yourtable where price between {low} and {high}
now with the help of the variable window set the low and high value and also give default values. I suggest 0 for low 9999 for high. This means that when you enter the page without specifying the low and high price you get the complete list.
|
|
|
 |
GreggB
|
| Posted: 01/13/2003, 4:38 AM |
|
I have done something similar with date ranges which should work for price ranges.
If you are just displaying data, I think it would be easier and faster to leave the DataSource as "Table" rather than changing it to "SQL". This will avoid having to manually create or change the "Select" in SQL in the "DataSource" for Grid.
Assuming you field name is "price".
Search Form:
Add 2 List or Text boxes. My preference would be to use "List Boxes".
s_price_low
s_price_high
Change the "datatype" and "format" as needed i.e. Datatype:"float" & Format:"0.00"
--------------------
Grid:
Agian change the "datatype" and "format" for "price".
Open the DataSource leaving it in the "Table" mode. In the "Where" section add the field "price" twice.
Where:
Feild: Condition: Parameter:
price great than or equal (>=) s_price_low
price less than or equal (<=) s_price_high
Set the format "0.00" and default values as Ron mentions "low 0, high 999999"
Now highlight them both by holding down the "Shift" key and selecting them. After they are both higlighted, click on the "()".
------------------
Hope this helps.
|
|
|
 |
Lindsay Smith
|
| Posted: 01/16/2003, 10:46 AM |
|
I am using access, With MSJet.
Lindsay
|
|
|
 |
Lindsay Smith
|
| Posted: 01/20/2003, 5:09 AM |
|
I am currently using asp. Access datatbase, And I kinda do not understand the directions you gave. Where do I make the changes. I am not very good at this yet so any help you can provide is way kewl.

Dorkrina@hot.rr.com
|
|
|
 |