|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Date ranger as filter
Hi everyone.
Please help me if there is a way to filter using a date range What I have is a filter for the current date only Here is my code Code:
<%
Dim Conn, Rs, sql
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("dtag.mdb")
sql= "SELECT dt.msg, dt.user, dt.date, dt.time, dt.type FROM dt;"
Rs.Open sql, Conn
rs.Filter = "date = #" & Date() & "#"
Do While not Rs.EOF
Response.Write ("<tr>")
Response.Write ("<td>"&"<font color=blue>"&Rs("date")&"</td>"&"<br>"&"</font>")
Response.Write ("<td>"&"<font color=blue>"&Rs("Time")&"</td>"&"<br>"&"</font>")
Response.Write ("<td>"&"<font color=red>"&Rs("user")&"</td>"&"<br>"&"</font>")
Response.Write ("<td>"&Rs("msg")&"</td>"&"<br>"&"<br>")
Response.Write ("</tr>")
Rs.MoveNext
Loop
Response.Write "</table>"
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
%>
Thanks in advance |
|
#2
|
||||
|
||||
|
-->Thread moved to ASP Development
have you tried: Code:
rs.Filter = "date BETWEEN #" & Date() & "# AND #" & date2 & "#" or you can do it in your query and bypass the rs.Filter line Code:
sql= "SELECT dt.msg, dt.user, dt.date, dt.time, dt.type FROM dt WHERE dt.date BETWEEN #" & Date() & "# AND #" & date2 & "#;" Rs.Open sql, Conn
__________________
Come JOIN the party!!! Quote of the Month: Pretension: The downside of being better than everyone else is that people tend to assume you're pretentious. Questions to Ponder: You can be overwhelmed and underwhelmed, but why can't you be simply whelmed? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#3
|
|||
|
|||
|
Date range filter (need help)
Thanks for the asnwer
Im getting this error Error Type: ADODB.Recordset (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. /dtag/test.asp, line 11 i used this code Code:
rs.Filter = "date BETWEEN #" & Date() & "# AND #" & 8/16/2009 & "#" is there something wrong with the date format I entered? thanks for helping |
|
#4
|
||||
|
||||
|
If you are hardcoding the value then it needs to be within the string, eg:
Code:
rs.Filter = "date BETWEEN #" & Date() & "# AND #8/16/2009#" Or you could use a variable, eg: Code:
Dim dt2 dt2 = "8/16/2009" rs.Filter = "date BETWEEN #" & Date() & "# AND #" & dt2 & "#" |
|
#5
|
|||
|
|||
|
Thanks sir for the help and spoon feeding,
I will try that,which made me think is it possible if I use a form with two text box intended for the start date and the end date of the date range I will use in the filter? If for example I name the text box as start and end? Im actually did not study asp in school,all I study is based on the internet,Im using this application for my home bussiness bec I cant afford a developer. |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Date ranger as filter |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|