View Single Post
  #6  
Old June 6th, 2010, 05:06 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default date and time query

domaze via AccessMonster.com wrote:

Marshall Barton wrote:
Date/Time values are internally represented as Doubles with
the fractional part being the part of a day. It appears

[quoted text clipped - 18 lines]
arithmetic in the time value. That's the "bug" I guess... That is why i'm
going crazy...


I tried every way I can think of to reproduce (A2003) it and
could not get that effect. I don't know of anything that I
can add to what I said earlier.

maybe you can use the Immediate window to triple check the
value in the form text box. See if you get the same ouput
from these two lines:

?CDbl(Forms!yourform.thetextbox)
and
?CDbl(#13:00:00#)


i am using Access 2007
i tried this an the result is on both 0.666666666666666666667
maybe there's a problem with rounding numbers....


That's the same value I got when I did that.

Any rounding here is only done as part of displaying the
value and should not have any effect on the value itself.

But...
Now this is really hard for me to understand.
i was trying to fix the time comfusion by assing General date types in the
program and i fell onto this problem


General Date is a display Format and has no effect on the
type or value. OTOH, a date style format will influence
Access if it thinks it has to convert a text string to a
date value. Is it possible that the start/end time fields
in the table are Text fields?

i get the values i present here in the debug mode.

starttime = "29/05/2008 11:30:00 am"
endtime = "29/05/2008 1:00:00 pm"

in the code there is a line like this
if endtime = starttime then msgbox("Wrong Parameters")

the funny thing is that i see the message box...


Now it is really starting to sound like your fields are Text
fields so the comparison is a text comparison. It is
imperative that date/time fields in the table are Date data
type.

I have no idea how the date came into the picture. I
thought these values are were only times. If they were only
times, without a date part, they would display as just the
time or have the date 30 Dec 1899. I guess another
important point is the question of how you are entering the
start/end times into the fields?

--
Marsh
MVP [MS Access]