Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Between Dates on Access doesnt work right
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Between Dates on Access doesnt work right

 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: Between Dates on Access doesnt work right
    Posted: 10 April 2003 at 3:04am

ok - i would post in my old thread but it says in the rules "dont bring up old threads" so my old thread is on page 3

*start edit* sorry forgot to add the link in: http://forums.webwiz.net/forum_posts.asp?TID=1426&PN=3 *end edit*

and i was wondering why i get this error:

error '80020009'

Exception occurred.

/calls-report-results.asp, line 51

it only happens on certen dates like if i do between"10/03/2003" and "10/04/2003"

but if i change the first one to a diff date it will work - or sum dont

its kinda annoyin - anyone know how to fix it?



Edited by Scotty_32
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: 11 April 2003 at 10:48pm
show us your code
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: 14 April 2003 at 4:59am

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

umm there ya go - thats my code

it sum times works, but sumtimes doesnt
could it be beocse sumtimes i dont have that date in my database?

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: 14 April 2003 at 5:09am

Well if it only fails 'sometimes' then it probably means that the variables you are using are either not receiving data, or are causing some sort of error in your logic.

Obviously the DateFrom and DateTo variables that you are using are causing the problem. Either DateTo is before DateFrom, or the date formats are causing issues (such as American versus 'rest-of-the-world' date formats.)

When you come across an error, response.write(sql) and see exactly what is being sent to the database.

Cheers,
Andrew

There have been many, many posts made throughout the world...
This was one of them.
Back to Top
faubo View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
Post Options Post Options   Thanks (0) Thanks(0)   Quote faubo Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2003 at 9:46am

it's because access store the dates in US format, no matter what version you have... my brazilian version do this too...

you have two options, store the dates in a different format (I don't remeber the name of this...)

or... a little workaround I use in my site:

Before the query:

LCID=1033 (us LCID)

and before you start to writte your html (and after the query) put

LCID=yourLCIDcode

this way the code and access will understand the same date and you will still keep yuor country format for the visitors

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.