Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

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.

0
RyanBank
Asked:
RyanBank
  • 5
  • 4
1 Solution
 
Rob_JeffreyCommented:
Try msgbox CDec(83/124678)
you can even :

msgbox round(CDec(83/124678),6)
0
 
Rob_JeffreyCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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_JeffreyCommented:
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_JeffreyCommented:
No problem.  
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now