Solved

Access database and date errors

Posted on 2004-09-15
8
166 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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