msgbox 83/124678 =6.65714881534834E-04 ?

Hi,

Please assist how can we resolve, when using vb to divide the results returned 6.65714881534834E-04

msgbox 83/124678
return should be: .000665

Thanks.

RyanBankAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Rob_JeffreyConnect With a Mentor IT/ProgrammingCommented:
Try msgbox CDec(83/124678)
you can even :

msgbox round(CDec(83/124678),6)
0
 
Rob_JeffreyIT/ProgrammingCommented:
The base math uses a Double for data storage while you are looking for a Decimal.
0
 
RyanBankAuthor Commented:
Sweet! What does Cdec do ?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
RyanBankAuthor Commented:
jimhorn,

Thanks!
0
 
RyanBankAuthor Commented:
sorry to be of trouble jimhorn, thanks for the help!
0
 
RyanBankAuthor Commented:
Rob_Jeffrey,

Would you happen to know how can we use Cdec() in a sql query?

StrSql="select " & Cdec( & "Col1/Col2" & ) &"  <--returned an error when using Cdec

Thanks!
0
 
Rob_JeffreyIT/ProgrammingCommented:
SELECT CAST((99/84734) AS decimal) AS test;

This works fine on Transact SQL and MySQL Server.  Dies on Access.  
0
 
RyanBankAuthor Commented:
Found it! thanks for the help!

Select
Format( Col1/Col2,##.00000')
From MyTable
0
 
Rob_JeffreyIT/ProgrammingCommented:
No problem.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.