Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REQ: FIlter by month code

Status
Not open for further replies.

Trekk

Programmer
Aug 16, 2001
66
US
I was giving some code to use for an ASP page to use a where statement on a function called Before SQL load

The code is strSQL = AddWhere(strSQL, "[CareCoordinators]='" & session("UserID") & "'")

I need to also have it filter by the current month to display all records by the carecordinators within in the current month
 
Also...

The type of database will be important. In my experience, date manipulations are considerably different between the various database engines. What type of database are you using? (Access, SQL Server, Oracle, etc...)



-George

"the screen with the little boxes in the window." - Moron
 
It is probably be better to add the date criteria to the WHERE clause ... the other technique is to return all records and use the recordset's Filter property but this is wasteful.
 
Here is the function in the asp file,the program does not allow for where statements while building the SQL query so I was told it had to be put in on the before SQL load function

strSQL=SESSION(strTableName & "_sql")

templatefile = "After_Care_Reprot_report.htm"
DoEvent "BeforeShowReport smarty,templatefile"
smarty_display(templatefile)

function GetGroupStart(field,value)

end function



function GetGroupDisplay(field,value)

end function

function MyCDbl(val)
if isnull(val) then
MyCDbl=0
exit function
end if
if val="" then
MyCDbl=0
exit function
end if
if not IsNumeric(val) then
MyCDbl=0
exit function
end if
MyCDbl=CDbl(val)
end function
%>

Here is the SQL query

select [ParoleeID],
[LastName],
[FirstName],
[CareCoordinators],
[AuthUNits],
[OwnerID]
From [ACauths2]
 
Also sorry it is an access 2003 database
 
the program does not allow for where statements while building the SQL query

How can anyone build a database applicatin without using the WHERE clause?
 
its called ASP runner pro, sucks but that is what we use
 
Tell them to hire some real programmers. The lack of where clause means they don't know what they are doing and shouldn't be allowed near a web server, let alone anything more complicated than a 14 button calculator.

The first thing I would try is to see if you can overload their AddWhere function like so:
Code:
AddWhere(strSQL, "[CareCoordinators]='" & session("UserID") & "'[highlight] AND [MyOtherField] > 'some value'[/highlight]")
You would have to provide real values, that was just to show what I was talking about.

Also, if you could provide the code that actually calls the SQL statement and the AddWhere function, they would be a better example of what we need to look at to determine what is going on.

-T
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top