time is equal

B

bindurajeesh

this one has me stumped.

I move through a recordset and place ending time in a variable (timeout) and
then move to next record and then compare that ending time with the new
records begin time (rs1!los_beg_time). if timeout <= rs1!los_beg_time then I
move to the next record. else I then have code give a message box which
gives me the client number and the timeout and the rs1!los_beg_time.

code operates just fine on all records except one. the timeout for this
record is 4:00:00 PM and the rs1!los_end_time is 4:00:00 PM. the code goes
to the else part of the if because it thinks that the two pieces are not
equal. i converted both to a dbl and they both are 0.6666666667. I did this
in the immediate pane. I checked in the immediate pane if the previous
record was truely 4:00:00 PM and it was. This record should not be processed
and the code should move to a new record to test. What am i missing?
 
D

Douglas J. Steele

It could be round-off error. Rather than comparing Field = SpecificValue,
try using Abs(Field - SpecificValue) < 0.01
 
B

bindurajeesh

thank you for the suggestion. that did not work. I did a len(timeout) and
got 8 and did an len(rs1!los_beg_time) and got a 10. I have checked the
fields for comparableness and they are both set to medium integer with the
same input mask.
 
D

Douglas J. Steele

Access doesn't have a Time data type. Do you mean they're Date, or are they
times stored in Text fields?
 
B

bindurajeesh

sorry for the confusion. it is a date/time data type with medium time and a
input mask. further description of the problem -- one field has 4 :00 PM and
the other field has 4:00:00 PM
 
D

Douglas J. Steele

Date/Time values don't actually have a format: they're eight byte floating
point numbers, where the integer portion represents the date as the number
of days relative to 30 Dec, 1899, and the decimal portion represents the
time as a fraction of a day.

Is it possible that while you're only seeing the time, they also contain
date? To ensure you're only comparing times, you can use the TimeValue
function.

If you're sure there's no date component, it's still possible that it's
round-off error. Use the DateDiff function to determine how many seconds
there are between the two values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top