I have a few fields that are imported from aonther program. They are "time"
fields, although in the Dabase they are txt fields. (due to the way the
other program exports the data)
is there a way to convert those fields to actual time values to do time
calculations?
i have fields like 'StartTime' 'EndTime' 'PrevEndTime'
they are in the format 'xx:xx:xx' where x is a number 0-9 and the clock is
a 24 hr clock, i.e. 1 P.M. is 15:00:00.
i want to convert those text (remember they are text fields) to time fields
co i can calculate "End time minus Start time" (for total time) and "Start
time minus prevendtime" for "time between sets"
is this possible, or would i have to try and change the way the program
exports the data, and make it into a time field?
>I have a few fields that are imported from aonther program. They are "time"
> fields, although in the Dabase they are txt fields. (due to the way the
[quoted text clipped - 14 lines]
> is this possible, or would i have to try and change the way the program
> exports the data, and make it into a time field?
TimeValue([YourField])

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Using either the CDate or TimeValue functions should do it.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I have a few fields that are imported from aonther program. They are
>"time"
[quoted text clipped - 18 lines]
> is this possible, or would i have to try and change the way the program
> exports the data, and make it into a time field?
Mike - 21 Nov 2006 15:38 GMT
Is there a way to have a "Long Date" that ueses the 24 hr. clock w/o haveing
the A.M./P.M.??
I have the Total time = finishtime - starttime. this should be something
like 3:43:54 as in it took 3 hrs, 43 min and 54 sec to do the task. however
when i do my calculation (the total time field is set to long date) it comes
up as 3:43:54 A.M. as in 43 minutes and 54 seconds past the third hour of
the day.
i know i can just set to short date, but i would like to have the seconeds
in there (seconds matter) :-)
any help would be appreciated.
> Using either the CDate or TimeValue functions should do it.
>
[quoted text clipped - 20 lines]
> > is this possible, or would i have to try and change the way the program
> > exports the data, and make it into a time field?
Rick Brandt - 21 Nov 2006 15:46 GMT
> Is there a way to have a "Long Date" that ueses the 24 hr. clock w/o haveing
> the A.M./P.M.??
You are not limited to the "named" formats. Use an explicit format string
like...
"mm/dd/yyyy hh:nn:ss"

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Mike - 21 Nov 2006 15:58 GMT
Wow. Thanks. I didn't realize that.
works like a glove!
> > Is there a way to have a "Long Date" that ueses the 24 hr. clock w/o haveing
> > the A.M./P.M.??
[quoted text clipped - 3 lines]
>
> "mm/dd/yyyy hh:nn:ss"
Mike - 21 Nov 2006 16:22 GMT
Now, how would i check if statements in VBA? Like if the time spills over
such as the end time is say 1:30 am but the start time was 11 PM (of the
previous night) just doing a finish minus start would say that was 21.5
hours (time is absolut value, right?) between start an finish when in
actuallity there was 2.5 hours. right?
i wanted to check if the finish time was less than the start time. that way
the math could add a step where the time is subtracted from 24, thus giving
the correct time, right?
i just have
If [FinishTime]<[HeatStartTime]
TotalHeatTime = 24 - TotalHeatTime (it could also be
24-([heatstart]-[finish]) right?)
Endif
but it comes with Compile Error: Expected Then or GoTo
help?
> > Is there a way to have a "Long Date" that ueses the 24 hr. clock w/o haveing
> > the A.M./P.M.??
[quoted text clipped - 3 lines]
>
> "mm/dd/yyyy hh:nn:ss"