copies per minute/# to = short time?

mkelly

Registered User.
Local time
Today, 14:48
Joined
Apr 10, 2002
Messages
213
I am working on a production DB for a copy center my question is:

can I divide 2 numbers and come up with a short time?

I have
[number of copies]/[copies per minute] and I want the answere to be in short time. Can anyone help with this. :confused:
 
The bad news is that time has very special meaning to Access (and other parts of Office) because a Date field is actual a double-precision quantity of days and fractions thereof since a reference point. Special formatting routines in Access convert the date type into the familiar string formats. You are going to create a number that isn't a typical Date field 'cause it is based on the wrong date.

The RIGHT way to do this that won't cause headaches is to create your own little Public String Function in a general module. The input can be a Real or Double quantity (you choose Real/Double when you write it, but then have to use it that way forever.) Then do some sexagesimal math to split your time up as two numbers separated by a colon. The first number can be any free-floating number of digits (left of colon). The second number has to have one digit and one leading digit/leading zero. Then you concatenate them in your function and return the result. Once you have this, you never again need to worry about the miserable little time format routines.
 
Thanks for the assisance however could you please state that in english?
 
if its 10 copies
and 2 copies per minute
then it will take 5 minutes...

10/2/24/60/60

Time is actually a double, 1 = a day.... so devide by 24 (to get hours)then devide by 60 (you have minutes), finaly again by 60 to get to seconds....
Then just apply a format of HH:NN:SS to the text box and your done...

Greetz
 
With due respect to namliam, his method flips out if your answer is longer than 24 hours for a net print job, I think. Unless something has changed in the way Access works on time fields.

In English, your problem is:

Date/Time fields are stored as a relative number - the number of days and fractions thereof between the given date and a reference date.

When you try to do something that results in a field that you think OUGHT to be some kind of time-based thing, you find that the standard date/time formatting routines often go nutzo on you because they AREN'T based on the reference date, but Access doesn't have a way for you to tell it that. It gamely tries to convert your number, only to find that whatever it is, it isn't a "real" date/time fields. 'cause the answer gets a bit bizarre, maybe looks like a date in 1900 - or 1970, depends on more factors than I care to contemplate at this time as to which one.

So the right way to do this and forever ignore Access's stultified view of the world is to build a function that takes some number that you provide and treat it as a number of hours - or minutes - or seconds, you have to decide which when you write it. Never mind real or double, just give it a number of some kind. But ALWAYS of the SAME kind and ALWAYS of the SAME meaning. If you give it long-integer seconds, ALWAYS give it that. Then, when the function gets called, it converts the number to the text format you want explicitly.

Suppose your little routine takes seconds and converts it to text. What you do is build a public string function in a general module. One input argument, which is (for this case) estimated seconds.

So it takes the integer and divides it by 3600. That quotient is the number of hours. Also take the remainder using MOD. Now divide the remainder time by 60. The quotient is the number of minutes. The remainder is the leftover seconds.

Convert those three numbers to text formats. Allow the hours to be five or six digits if you want. Make the minutes and seconds have fixed, two-digit formats with leading zeroes. Concatenate the mess, with each digit string separated by colons. Return the concatenated string as hhhhh:mm:ss.

If this is a public function, you can use this routine in queries, forms, and reports as often as you wish as long as you give it what it wants for input.
 
The_Doc_Man said:
With due respect to namliam, his method flips out if your answer is longer than 24 hours for a net print job, I think. Unless something has changed in the way Access works on time fields.
You are right offcourse, tho i cannot imagine a printjob taking longer than a day....
 
Perhaps I can because I work at a U.S. Navy site. NAVPUBS documents can go on seemingly endlessly, and to generate more than a couple of copies CAN DEFINITELY go on endlessly.

That's actually one advantage of working where I do. I get to see extreme usages all the time. Which means when something is stressed to the breaking point (other than ME), I can usually see it happen and do some analysis on the aftermath.
:D
 

Users who are viewing this thread

Back
Top Bottom