This topic is locked

limit list view by month

8/26/2007 1:12:03 PM
ASPRunnerPro General questions
W
wilsonk author

in the lsit page all records are shown in the table, how would I limit the list page to show only the curent month of records.
Thank you

C
chris 8/26/2007

in the lsit page all records are shown in the table, how would I limit the list page to show only the curent month of records.

Thank you



As Sergey has said in the past.

You need to use date functions in SQL query to calculate the beginning of the month and end of the month.

Here is the article that can help:

http://www.databasejournal.com/features/ms...cle.php/3650031


Then use a 'where statement' in the SQL query.

Hope that helps.

Chris

W
wilsonk author 8/27/2007

ok, I found the post where it was suggested to use strSQL = AddWhere(strSQL, "[employee='" & session("UserID") & "'") to filter by login name which works

now I want to also add an additional where clause to filter by the month which I have this code WHERE contactdate >= GETDATE()-{fn CURRENT_TIME}-DAY(GETDATE())+1

"' AND conactdate < DATEADD(MONTH, 1, GETDATE()-{fn CURRENT_TIME}-DAY(GETDATE())+1)
How can I combine both where statements to work on the befre SQL Query

A
ac163601 8/27/2007

ok, I found the post where it was suggested to use strSQL = AddWhere(strSQL, "[employee='" & session("UserID") & "'") to filter by login name which works

now I want to also add an additional where clause to filter by the month which I have this code WHERE contactdate >= GETDATE()-{fn CURRENT_TIME}-DAY(GETDATE())+1

"' AND conactdate < DATEADD(MONTH, 1, GETDATE()-{fn CURRENT_TIME}-DAY(GETDATE())+1)
How can I combine both where statements to work on the befre SQL Query


Wilson,

Inside the 'Security' tab of ASPRunner, you can allow users to only see their own records. This is the best way of limiting access. After that, build your query to show current months' records.

W
wilsonk author 8/27/2007

ok so I have set the security code, but I still cant get the code corect to dosplay records for the current month. do I still need to use the strSQL = AddWhere since it is an asp runnner function? sorry if its is obvious but it isnt to me. This is for a report page
Thanks