Solved

msgbox  83/124678 =6.65714881534834E-04 ?

Posted on 2006-07-21
12
170 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
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!

 

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 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