Advanced Search Default Values to Look for |
10/19/2005 03:34:42 | |
ASPRunnerPro General questions | ||
author
Hi is it posible to set default values to a date field in advanced search with "between" condition so we can show only records updated within the last two days? Then allow the user to change the values to search for? |
||
![]() |
Sergey Kornilov admin 10/19/2005 |
You can do this by adding the following three lines in the beginning of list page (see in bold) Session("SearchOption_" & strTableName & "DateField") = "Between" Session("SearchFor1" & strTableName & "DateField") = FormatDatetime(DateAdd("d", -2, now()),2) Session("SearchFor2" & strTableName & "_DateField") = FormatDatetime(now(), 2) Session.LCID = 1033
|
|
|
500350 11/17/2005 |
Sergey, thanks for the help. |
|
![]() |
Sergey Kornilov admin 11/17/2005 |
To point your users directly to advanced search results you can do the following: |
|
|
500351 11/17/2005 |
Thanks Sergey: It work fine, but, there seems to be a problem; We select last 2 days of data (todays date -2) so tomorrow or next week is going to show the data as of today. |
|
|
500352 11/18/2005 |
May be forcing the action here. |
|
R
|
rodriguez 12/1/2005 |
Hi Sergey, could you please help us with this? |
|
![]() |
Sergey Kornilov admin 12/1/2005 |
I'm kind of confused with what you trying to achieve. |
|
R
|
rodriguez 12/1/2005 |
What I need to do is to display the page with the data already selected, with the dates between last 2 days |
|
![]() |
Sergey Kornilov admin 12/1/2005 |
I see what you saying. strSQL = AddWhere(strSQL, "1=0")
strSQL = AddWhere(strSQL, "DateDiff("d", DateField, now())<2 and ... ") |
|