VBA help

Soldato
Joined
26 Nov 2005
Posts
3,839
Location
Doon the Bay (Newcastle)
I'm a novice so bare with me.

I need a textbox to allow decimal points. I'm putting in hours and hourly rates and need for example 5.5 and 5.73 but when i do it rounds up or down so 5 and 6.

I've tried the decimal places but that doesn't seem to do anything, switched from auto to 1 but nothing happens, I'm using access 2007 btw.

Thanks in advance.

:D
 
Hi,

After setting the field to Decimal, have you set the scale to 2? (defaults to 0 I think) as this is the qty of digits to the right of the decimal place.

Hi, set the hour rates field to currency which now formats it perfectly, but cant get my hours right.

Could you explain in a bit more detail about setting the field to decimal, where am i doing this? In the table or form, or both?

Thanks.
 
Ok thinking of putting the hour rate in date and time, so 5.5 hours now reads as 05:30:00

How on earth would i calculate total wage if i had 5.73 (txtbox1) x 05:30:00 (textbox2) on a button to display in textbox3?

?
 
Ok been hunting around and found this:

Put this in the Control Source property of the txtbox3 text box:

=[txtbox1]/(Hour([txtbox2])+(Minute([txtbox2])/60))

And it almost works, well its doing something only for £5.73 x 4 hours it = 1.4325


but for 1 hour it comes out at 5.73

Any ideas?

Also how would i save this figure to my table?
 
vbadr8.png


=[Rate]/(Hour([Hours])+(Minute([Hours])/60))


Agh.

needed:

=[Rate]*(Hour([Hours])+(Minute([Hours])/60))

Oh well.

:D

Still need to be able to save the amount to my table any ideas on that!?
 
Last edited:
Thanks, yeah got the / & * wrong.

All this is very new so all advice welcome, and thanks for it.

Really need to save the result to my table now, having a look about for that ATM, but if anyone knows what i need to do please let me know.

I was thinking along the lines of a hidden textbox which contains a mirror value of the pay result which then is saved when pressing the save button (like all other fields) would that work?
 
Back
Top Bottom