Solved

msgbox  83/124678 =6.65714881534834E-04 ?

Posted on 2006-07-21
12
167 Views
Last Modified: 2010-04-30
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
Comment
Question by:RyanBank
  • 5
  • 4
12 Comments
 
LVL 9

Accepted Solution

by:
Rob_Jeffrey earned 500 total points
ID: 17154400
Try msgbox CDec(83/124678)
you can even :

msgbox round(CDec(83/124678),6)
0
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17154405
The base math uses a Double for data storage while you are looking for a Decimal.
0
 

Author Comment

by:RyanBank
ID: 17154409
Sweet! What does Cdec do ?
0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

Author Comment

by:RyanBank
ID: 17154431
jimhorn,

Thanks!
0
 

Author Comment

by:RyanBank
ID: 17154469
sorry to be of trouble jimhorn, thanks for the help!
0
 

Author Comment

by:RyanBank
ID: 17154545
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
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17154737
SELECT CAST((99/84734) AS decimal) AS test;

This works fine on Transact SQL and MySQL Server.  Dies on Access.  
0
 

Author Comment

by:RyanBank
ID: 17154927
Found it! thanks for the help!

Select
Format( Col1/Col2,##.00000')
From MyTable
0
 
LVL 9

Expert Comment

by:Rob_Jeffrey
ID: 17154952
No problem.  
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question