significant figures

A

Andy Levy

Hi

I have a number in a text box on my form that has about 8 significant
figures

I am calling that number into a vba function - but when i do it rounds it to
6 significant figures - which throws the calculation off course.

I have tried using CVar(me.textbox) to get it to be a variant type but to no
avail . I have tried Googleing - "vba access significant figures" but found
nothing

Any ideas

Many thanks

Andy
 
N

Newbie

could you post any code you have?

I have tried an unbound text box that on the click of a button it multiples
the value by 3 and returns the result in a msgbox. Each time, whatever the
number, the correct answer is returned.
 
J

John Vinson

Hi

I have a number in a text box on my form that has about 8 significant
figures

I am calling that number into a vba function - but when i do it rounds it to
6 significant figures - which throws the calculation off course.

I have tried using CVar(me.textbox) to get it to be a variant type but to no
avail . I have tried Googleing - "vba access significant figures" but found
nothing

It sounds like you have this textbox bound to a table field with a
datatype of Single. A Single floating-point number is in fact limited
to approximately 7 digits precision (to plus or minus 2^-24 to be
exact). Consider changing this field to Double, which will give you
approximately 14 digits precision.
 
A

Andy Levy

Hi

Thanks for your help

'The value of myTextBox on my form is 106666700.00
Debug.Print "myTextBox Value = " & Me.myTextBox

'Which produces "myTextBox Value = 1.06667E+08

So it is only showing 6 significant figures - when really i need it to show
upto 10 sig figs

Thanks

Andy
 
A

Andy Levy

Oops

What i meant was

'The value of myTextBox on my form is 106666789.98
Debug.Print "myTextBox Value = " & Me.myTextBox

'Which produces "myTextBox Value = 1.06667E+08

So it is only showing 6 significant figures - when really i need it to show
upto 10 sig figs
 
K

Keiran

Oops

What i meant was

'The value of myTextBox on my form is 106666789.98
Debug.Print "myTextBox Value = " & Me.myTextBox

'Which produces "myTextBox Value = 1.06667E+08

So it is only showing 6 significant figures - when really i need it to show
upto 10 sig figs

I can't duplicate your error, but have you tried using the Format
function? It'd be something on the order of
Format(Me.myTextBox,"0.00") for 2 decimal places.
 

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

Top