afrausto
Posts: 66
|
| Posted: 11/21/2005, 5:13 PM |
|
Hello,
I have a search form and grid on a single page. One of the options is s_Year which is a drop-menu displaying the following options: Show All Years, Year1, Year2, Year3,... By default, if s_Year is empty then it's set to the current year, which occurs when a user first visits the page.
I would like to be able to modify s_Year when it's equal to "Show All Years" before the select statement is executed, but I'm not sure what the proper coding is to accomplish this. My thought was to remove s_Year from the WHERE statement but still preserve the other search criteria.
Does anyone know how to accomplish this?
Thanks,
Albert
|
 |
 |
Edd
Posts: 547
|
| Posted: 11/21/2005, 5:35 PM |
|
Albert,
You could try this
Go to the s_Year select right click it and change select properties default from empty to zero.
Go to the grid and get the s_Year paramater and change it's default to zero.
Change the select mode of the Grid from Table to SQL.
In the Selelct statement where it says
XXX.year like {s_Year}
change it to
( XXX.year = {s_Year} or {s_Year} = 0)
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
afrausto
Posts: 66
|
| Posted: 11/23/2005, 3:27 PM |
|
Edd,
Thanks for the suggestion, but it doesn't seem to work as I would like.
By default, when someone first comes to the page I want it to only pull up the records where Year is equal to Year(Date) or the current year. So if parameter s_Year is Empty it's set to Year(Date).
I would like to remove s_Year from WHERE of the SELECT statement if s_Year is equal to "Show All Years". That way all records will display, regardless of Year.
Thanks for your help.
Albert
|
 |
 |
Edd
Posts: 547
|
| Posted: 11/23/2005, 5:29 PM |
|
Albert,
Set the default value s_Year in the grid and the search criteria to DatePart("yyyy",Date()) .
This means the first time they come in they get the search criteria saying the current year and the grid retrieving the current year.
When they change the search criteria to ALL (sends a zero) then the SQL as stated above will fire correctly.
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
|