How do you limit the number of zeros that are displayed past the decimal point? Right now we are 12 out from the decimal
How do you limit the number of zeros that are displayed past the decimal point? Right now we are 12 out from the decimal
Forms allow you to control what is displayed.
How do you limit the number of zeros that are displayed past the decimal point? Right now we are 12 zeros past the decimal
The calculation are taking place within my form. The issue is that even after setting the the decimal places to 3 in the property sheet we still get a value that looks like this: 2.568975545545151
The property sheet of the control that displays the value?
I am not sure what you mean.
What property sheet? How are you doing the calculation?
It would be easier to show you. I am going to upload a 2003 demo to you can view it.
To see that I am talking about first select a part number from the drop down list, then add a value to the Lengths field, then look at the StaHrs field. you will see if you select 31150 part number then enter 1000 in the Lengths field
you that StaHrs has a value of 34.9099099099099. I want to see something like 34.909
Use the Round() function or Format() function to control the output of the calculation. The Format properties of controls only work on the data in fields bound to the control.
So, would I need to add the format value to the current vb code to get the format I am looking for?
If I added this
to thisCode:Me!HrsErnd.Format = "Fixed"
would I get the format I am looking for?Code:Sub CalcProduced1() If Not IsNull(Me.NumberOfMachine) And Not IsNull(Me.HrsErnd) Then Me.HrsErnd = 480 / Me.NumberOfMachine / 60 Me!HrsErnd.Format = "Fixed" <<<< Correct?>>>>> Else Me.HrsErnd = "" End If End Sub
Nope! You need something like:
Me.HrsErnd = Round(480 / Me.NumberOfMachine / 60, 3)
Go to your design view of the form.
Open Properties Box.
Click on the Text Box in question.
Go to the Format Tab.
I think it is somewhere near the top. "Decimal Places" Set the value there.
Warning............... If you do calculations on this value it might not give the exact result you were hoping for. e.g.
1.004 + 1.004 = 2.1
But if you were showing
1.00 + 1.00 you would expect 2.00
Trust you understand. If not post back.
Sorry this was a double post. You answered my question in the other post
StaHrs is of Data Type Text.
Why is it so.
Make it a number. I would suggest Field size of Decimal
I have tried to change it from text to a number from within the dataentry table but that caused the calculation to quit working. Could I have done it wrong?