Print Page | Close Window

how do a show between a certen Dates

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1426
Printed Date: 28 March 2026 at 11:06pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: how do a show between a certen Dates
Posted By: Scotty32
Subject: how do a show between a certen Dates
Date Posted: 28 March 2003 at 9:06am

ok, ive tryed:

sql = "SELECT * FROM Calls WHERE CallDate > " & DateFrom & " AND CallDate < " & Dateto & " ORDER BY CallDate DESC, CallTime DESC"

but that didnt work, it showed ALL dates

then i tryed:

if rsClient("calldate") > DateFrom AND rsClient("calldate") < DateTo then

but that just wouldnt show anyfin

*crappers i forgot to finish!*

anyway, can anyone find a fault in my coding? or better yet tell me how i do this - thanks for any help (please do help!)




Replies:
Posted By: michael
Date Posted: 28 March 2003 at 9:43am
Theoretically it should work if your data is formed right but this query is slow as it compares every record two times. Use syntax like the following instead:
"Select * from Calls where Calldate Between " & DateFrom & " AND " & DateTo "order by.......

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: Bunce
Date Posted: 28 March 2003 at 4:58pm

If you're using Access, it needs ## around the date values.

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: Scotty32
Date Posted: 31 March 2003 at 3:10am

 it works, thanks alot! to "Bunce"

and now i need to know how i can use the "=>" and "<=" in the Datebase string thing  

you know the

sql = "SELECT * FROM Calls WHERE CallDate => #" & DateFrom & "# AND CallDate <= #" & DateTo & "# ORDER BY CallDate DESC, CallTime DESC"

i know that doesnt work (as ive just tryed it) but i need to know how i can get the date to be that or above (or below)

if you understand me ..... soz dont know how to explain it



Posted By: Bunce
Date Posted: 31 March 2003 at 3:33am

BETWEEN!!

Where [FieldName] BETWEEN #Date1# AND #Date2#

Good luck!!

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: Scotty32
Date Posted: 31 March 2003 at 5:21am

 ok as am on a good luck streak could anyone tell me how i could loop thru date's from 1 date to the current one? is that possable?

i have an idea, if ya cant think of out ill run it post ya'll when ive tryed an failed



Posted By: Scotty32
Date Posted: 31 March 2003 at 6:17am

ok, its ok, i fixed the from - to in a drop down box...

who know it would work doin
<% for DateLoop = Date()-30 TO Date() %>

 HOW kool is that!

if anyones intressed then you can get a Dropdown box to show from a certen Date to todays Date by using this code
(thought id share wit ya'll)

<SELECT Name="DateFrom">
<% For DateLoop = DateValue("01/01/2003") To Date() %>
<OPTION Value="<%=DateLoop%>"<%if DateLoop = Date()-30 then Response.Write("SELECTED")%>><%=DateLoop%></OPTION>
<% next %>
</SELECT>




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net