Print Page | Close Window

Between Dates on Access doesnt work right

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=1729
Printed Date: 28 March 2026 at 11:14pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Between Dates on Access doesnt work right
Posted By: Scotty32
Subject: Between Dates on Access doesnt work right
Date 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 - 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?




Replies:
Posted By: Bunce
Date 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.


Posted By: Scotty32
Date 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?



Posted By: Bunce
Date 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.


Posted By: faubo
Date 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



-------------
http://www.conhecerparaconservar.org - I don't know how to make you click here



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