FUNCTIONS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field in my form called total time; it calculates the time out minus
the time in and gives me the difference in a time format. I know want to
change that to be a number format so that I can times the number by a rate.
Is this possible?
 
Renee

Take a look at the CInt() (or CCurr(), or ...) function in Access HELP.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I have a field in my form called total time; it calculates the time out minus
the time in and gives me the difference in a time format. I know want to
change that to be a number format so that I can times the number by a rate.
Is this possible?

How does it do the calculation?

I'd suggest using DateDiff("n", [Time In], [Time Out])

to get integer minutes (divide by 60 to get fractional hours of
course).

John W. Vinson[MVP]
 
My first calculation to figure out the total time is: =HoursAndMinutes([TIME
OUT]-[TIME IN]).
Then in a seperate field I would like it it take this number and convert it
to a number instead of time format so I may calculate it with a rate.

John Vinson said:
I have a field in my form called total time; it calculates the time out minus
the time in and gives me the difference in a time format. I know want to
change that to be a number format so that I can times the number by a rate.
Is this possible?

How does it do the calculation?

I'd suggest using DateDiff("n", [Time In], [Time Out])

to get integer minutes (divide by 60 to get fractional hours of
course).

John W. Vinson[MVP]
 
My first calculation to figure out the total time is: =HoursAndMinutes([TIME
OUT]-[TIME IN]).

That returns a Text string.
Then in a seperate field I would like it it take this number and convert it
to a number instead of time format so I may calculate it with a rate.

Why call a function to convert two times to a text string, and then
another function to convert it back to a number? You only need ONE
function call - DateDiff() - to get a number which can be used in your
calculation.

If you need both the HoursAndMinutes for display, and the DateDiff()
for the rate calculation, just use two separate calculations.

John W. Vinson[MVP]
 
So how do I use the DateDiff() function then? I looked on the help and can't
seem to figure it out.

John Vinson said:
My first calculation to figure out the total time is: =HoursAndMinutes([TIME
OUT]-[TIME IN]).

That returns a Text string.
Then in a seperate field I would like it it take this number and convert it
to a number instead of time format so I may calculate it with a rate.

Why call a function to convert two times to a text string, and then
another function to convert it back to a number? You only need ONE
function call - DateDiff() - to get a number which can be used in your
calculation.

If you need both the HoursAndMinutes for display, and the DateDiff()
for the rate calculation, just use two separate calculations.

John W. Vinson[MVP]
 
I have figured it out now. Thank you very much for you help and time

Renee

John Vinson said:
My first calculation to figure out the total time is: =HoursAndMinutes([TIME
OUT]-[TIME IN]).

That returns a Text string.
Then in a seperate field I would like it it take this number and convert it
to a number instead of time format so I may calculate it with a rate.

Why call a function to convert two times to a text string, and then
another function to convert it back to a number? You only need ONE
function call - DateDiff() - to get a number which can be used in your
calculation.

If you need both the HoursAndMinutes for display, and the DateDiff()
for the rate calculation, just use two separate calculations.

John W. Vinson[MVP]
 
So how do I use the DateDiff() function then? I looked on the help and can't
seem to figure it out.

The first argument of DateDiff is a text string indicating the unit of
measure: "s" means Seconds, "n" miNutes, "h" Hours, "d" Days, "m"
Months. The second argument is a date/time value for the beginning of
the interval, the third is a date/time value for the end. So

DateDiff("n", [Start Time], [End Time])

would return 360 (minutes) if the end time is six hours after the
start time.

John W. Vinson[MVP]
 

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

Back
Top