Calculating with several fields

B

bob

The postings that i did get for time worked great. Now the issue is that i
want to link the fields together so it will calculate all the mons that are
left and pay a rate to that time. I have that part, that is take that field
and times it by a number. so here is what it looks like

Time IN 12:00:00 pm Time In 12:00:00pm Time In 12:00:00
Time out 13:00:00 pm Time out 13:30:00 pm Time out 13:45:00 pm
Delay Time 45 Delay Time 45 Delay Time 45
Total Time 15 Total Time 30 Total Time 45

now what i need to do is to add them up and if there is is not one that has
anything in it that is will still calculate it. Meaning that if 1 and 2 are
filled or just one is filled it will still calculate or add it up. I know
that their need to be fields for the toal time and the pay. what i need is
what to put for the null factor. if more info is need please ask

Thank you for your time
 
C

Chris O''''Neill

If I'm understanding your question correctly, you want to know how to make
sure a NULL field won't blow-up your calculations? That would be the NZ()
function:

NZ(fieldname,what-to-replace-NULL-with)

For instance:

NZ(Me.TotalTime,0) will put a zero in the TotalTime field if it is NULL.
So...

Me.Rate * Me.TotalTime will result in an error if TotalTime is NULL, but
Me.Rate * NZ(Me.TotalTime,0) will result in zero if TotalTime is NULL

Hope that helps...

Regards, Chris

P.S. Your calculations are wrong. The Total Tie for the middle column
should be 45 minutes, and the total time for the far right column should be 1
hour. Ya got the first column right, though! ;) :D
 
B

bob

Chris thank you for the help
the calculation works great. After i wrote this i figured it out with the Nz
sign.

here is a easy question the there anywhere on the net that has all the sign
or what ever they are called. I do know that there is different letters for
different purposes.
Iam kind of new at this.
 
C

Chris O''''Neill

You're welcome. Glad I can be of help for a change. :)

I'm pretty new to Access programming, too, so I'm not aware of an onlline
"dictionary" for all the VB/VBA functions. (Maybe someone else knows?) What
I do if I see a function I'm unfamiliar with is bring up the Access
expression builder, find it in the "All" list, and then hit F1 to call-up
Access Help. If the help is cryptic (and it often is), I'll do a search here
for it and will often find alot of good info. Finally, if that doesn't solve
it, I ask the question here and get tons of help. :D

Regards, Chris
 

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