?
Solved

Multiplication with Single  & Double datatype in Access 2003 give incorrect result

Posted on 2009-12-22
7
Medium Priority
?
234 Views
Last Modified: 2012-05-08
I have a simple Access table that has 3 columns ,the first is autonumber ,the second is of Number datatype and the Fieldsize is Sinlge ,the 3rd one is also Number and the FieldSize is Double ,the issue here when I create a query that mutliplies the 2nd and 3d coulmn (Single * Double) ,it will give incorrect results like if the 1st colume is 1100.55 and the second is 1.1 it would give inaccurate output ,i know there are issue arond floating points but what is the best solution to this delima ?
0
Comment
Question by:AJDeveloper
  • 4
  • 2
7 Comments
 
LVL 85
ID: 26104142
You can try Formatting the output:

SELECT CCur((SingleField * DoubleFIeld)) As CalcField FROM SomeTable

Of course, which of the Convert functions you use would depend on what you're trying to achieve ... there are many of them available, and this one (CCur) convert to Currency.
0
 

Author Comment

by:AJDeveloper
ID: 26104375
Thanks but the output is not mathmatically correct ,i checked other function as well ,sinlg and double function ,is there a way to get a correct result
0
 
LVL 31

Accepted Solution

by:
hnasr earned 1500 total points
ID: 26104539
Tried LSMConsulting's comment?
What result did you get?
Try
CDbl(CCur([sngField])*CCur([dblField]))
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:AJDeveloper
ID: 26104606
It worked ,but how ,what is the explaination ?
0
 

Author Closing Comment

by:AJDeveloper
ID: 31668944
I still need to understand how the usage of the function in this way helped give out correct results
0
 
LVL 31

Expert Comment

by:hnasr
ID: 26105678
This has to do with how computer stores variables in memory.
Check:
http://support.microsoft.com/kb/42980
0
 

Author Comment

by:AJDeveloper
ID: 26110286
Thanks guys for the help
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

839 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