Solved

msgbox  83/124678 =6.65714881534834E-04 ?

Posted on 2006-07-21
12
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Technology Partners: 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!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

623 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