Solved

msgbox  83/124678 =6.65714881534834E-04 ?

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

Author Comment

by:RyanBank
ID: 17154431
jimhorn,

Thanks!
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mysql vs Oracle 10 120
Use Multiple Forms 4 38
VBA saving file message display 5 47
vb6 connector to mongodb 2 27
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now