Solved

msgbox  83/124678 =6.65714881534834E-04 ?

Posted on 2006-07-21
12
166 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…

896 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

11 Experts available now in Live!

Get 1:1 Help Now