Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - how do a show between a certen Dates
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how do a show between a certen Dates

 Post Reply Post Reply
Author
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Topic: how do a show between a certen Dates
    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!)



Edited by Scotty_32
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post 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.......
Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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>



Edited by Scotty_32
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.