Link to home
Start Free TrialLog in
Avatar of lion79
lion79

asked on

convert value....very simple question

HI,
my question is pretty simple,i have a form that the user insert value in cu/m3 and i want it to be saved in the database as MGD which is equal to :(cu/m3)/4747
i tried this
textbox1=textbox1/4747 but gave me an error,whats the best way for the conversion???
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

textbox1.text = (convert.todecimal(textbox1.text) / 4747).tostring
Avatar of lion79
lion79

ASKER

i want to thank you emoreau for your answer but i need one more thing,the value comes in long decimal,i just want to save the 3 digits(0.264),how can i define that?
textbox1.text = formatnumber((textbox1.text / 4747) , 3)
or .. using emoreau comment
textbox1.text = formatnumber((convert.todecimal(textbox1.text) / 4747),  3).tostring
>>just want to save the 3 digits
if what u save is what u r concerned with and if u r using SQL server, u could just define the datatype to accept 3 decimals .. am not sure whether it is possible in MSAccess .. but am almost sure, there has to be an option for that ...
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lion79

ASKER

thanks alot for your help emoreau and you too Rej........