Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access database and date errors

Posted on 2004-09-15
8
Medium Priority
?
169 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…
Suggested Courses

618 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