This topic is locked

Current Date

2/7/2005 2:08:52 PM
ASPRunnerPro General questions
T
troyo author

Does anyone know of a way to make the default list page initially display records that match the current date? I have a field that uses the Now() function for record creation, and when users display the list page, I would like to be able to display that days info first, then if they want they can go back to other dates. Any help on this would be greatly appreciated. Thanks
Troy

Sergey Kornilov admin 2/8/2005

Here is how you can do this (this applies to MS Access database):

  1. Turn on No records on the first page option in ASPRunnerPro.
  2. Open ..._list.asp page in any text editor and replace the following section
    if Request.Form("action")="" then

        strSQL = strSQL & " where 1=0"

    end if


with this one

if Request.Form("action")="" then

    strSQL = strSQL & " where YourDateField = Date()"

end if


Do not forget to replace YourDateField with the real field name.

T
troyo author 2/8/2005

Sergey,
Thanks for the quick response on this. I tried your suggestion but now I only receive No Records Found when opening my ....list.asp page. The only difference I see is that my initial code that you wanted me to edit looks like this rather than what you posted.
if request.Form("action")="" then

Session(strTableName & "SQL")=""
end if
Let me know if I am missing something or if you have any further suggestions. Thanks
Troy

Sergey Kornilov admin 2/8/2005

Troy,
the code that you need to modify is located below in the same file. Just find it and make required changes.
Let me know if it helps.

T
troyo author 2/8/2005

Sergey,
Sorry about that. I found it and everything is working correctly. Thanks again for the quick response.
Troy