?
Solved

Access database and date errors

Posted on 2004-09-15
8
Medium Priority
?
167 Views
Last Modified: 2010-05-02
I have an access database where my application stores dates in the dutch notation:

dd-mm-yyyy

but when i run aq sql query with between 01-07-2004 and 01-08-2004 it returns nothing, when i enter these dates: 07-01-2004 and 08-01-2004 it works fine.

But somehow not when i do this in my application.
0
Comment
Question by:markyvt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12064040
Your dates are not stored in Dutch notation, they are displayed like that.
You have to specify get the correct date into the SQL. The easiest way to do that is #07/01/2004#. This notation only takes the American fomat.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 12064253
It is VERY importatn to understand how date values are actuyally stored in the database.  They are NOT stored as "mm-dd-yyyy" or as "dd-mm-yyyy" or even asn "yyyy-dd-mm".

Rather, Date type values are stored internally as  Numbers (of type DOUBLE), which have a Decimal point.  The integer part of the number (to the LEFT of the decimal point) is the NUMBER of days since Dec 30, 1899.  The fractional part (to the right of the decimal pont) holds the TIME of day as measured in seconds since midnight, as a fraction of 1 day (1 day = 86400 seconds)

so right now (Sept 15, 2004 at 9:16:46 AM Eastern Daylight Time) the value of the number would be:

38245.3866551

that means that Sept 15, 2004 is 38245 days since dec 30, 1899

and 9:16:46 AM is .386651  of 1 day( = 33406 seconds since midnight)

How the data is DISPLAYED is up to you, and by default, Access uses US formatting.

AW
0
 
LVL 4

Expert Comment

by:hamood
ID: 12064329
use query like this


select * from [Sample Table] where record_date between #1/1/2000# and #1/1/2001#

hamood
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Author Comment

by:markyvt
ID: 12331956
when i use #1/1/2004# till: #8/1/2004# it does 1 jan untill 8 jan and not 1 jan until 1 august.

How can i solve this ?
0
 
LVL 2

Author Comment

by:markyvt
ID: 12559858
Well the question is just half answered i still have this issue:

--
when i use #1/1/2004# till: #8/1/2004# it does 1 jan untill 8 jan and not 1 jan until 1 august.

How can i solve this ?
--
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 2000 total points
ID: 12561660
try this:

DateSerial(2004,1,1) tilL: DateSerial(2004,8,1)


it sounds like you have your regional settings set as DD/MM/YYYY (European) and you expect them to be MM/DD/YYYY (American)

AW
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question