[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • 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_JeffreyIT/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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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