ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 18th, 2009, 04:00 PM
loy_ramos loy_ramos is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 42 loy_ramos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 35 m 16 sec
Reputation Power: 2
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

Reply With Quote
  #2  
Old August 18th, 2009, 06:04 PM
mehere's Avatar
mehere mehere is offline
Senior Sarcasm Wizardess
ASP Free God 17th Plane (13000 - 13499 posts)
 
Join Date: Feb 2005
Location: Dreamland
Posts: 13,237 mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)mehere User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 10976 Folding Title: Novice Folder
Time spent in forums: 5 Months 1 Day 20 h
Reputation Power: 2012
-->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

Reply With Quote
  #3  
Old August 20th, 2009, 07:25 AM
loy_ramos loy_ramos is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 42 loy_ramos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 35 m 16 sec
Reputation Power: 2
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

Reply With Quote
  #4  
Old August 20th, 2009, 07:52 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 3,461 sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 1 Day 16 h 50 m 26 sec
Reputation Power: 1806
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 & "#"

Reply With Quote
  #5  
Old August 20th, 2009, 08:00 AM
loy_ramos loy_ramos is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 42 loy_ramos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 35 m 16 sec
Reputation Power: 2
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.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Date ranger as filter


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek