Converting Time to Format That Items Per Hour Can Be Calculated

G

Guest

I have a table with fields named Date, Items, StartTime(formatted ShortTime),
and StopTime(formatted). I have found a query that calculates the duration
of time using the expression Format([StartTime]-1-[StopTime],"Short Time").
This works very well as it calculates time over a 24 hour clock and between
dates.

My next task is to calculate items per hour but since the time is not
formatted numerically the simple calculation of [Items]/[Hours] won't work
and returns an error. How can I get the duration formatted to work in the
item per hour calculations?
 
V

Van T. Dinh

Use CDate() on your expression to convert it back to (date)time value from
String.

(Note: result of Format() is a Variant of String type.)
 

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

Top