Gustav Brock
Gustav at cactus.dk
Fri Dec 11 09:58:37 CST 2009
Hi Reuben What a relief! Thanks for the feedback! /gustav >>> accessd at gfconsultants.com 11-12-2009 16:50 >>> Nope. Just did it again and you're right. Yours works fine. I must have misplaced something when I was trying it Wednesday night. Sorry. Thanks, Gustav. Reuben Cummings GFC, LLC 812.523.1017 > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > Gustav Brock > Sent: Thursday, December 10, 2009 8:45 AM > To: accessd at databaseadvisors.com > Subject: Re: [AccessD] Rounding Error - A2K > > > Hi Reuben > > I did some tests with no errors and returning the correct > data type. Are you sure about this? > > /gustav > > > >>> accessd at gfconsultants.com 10-12-2009 12:57 >>> > Thanks. That appears to work. However, I think your > paranthesis are off. > For anyone wanting this for future use I had to change it to... > > > CurResult = CCur((CurAmount * CCur(100 * SngPercentage))/ 100) > > Only added two paranthesis (to completely inclose the > multiplication part), > but it makes sure the math gets done before it gets divided by 100. > > Thanks for the help. > > Reuben Cummings > GFC, LLC > 812.523.1017 > > > > -----Original Message----- > > From: accessd-bounces at databaseadvisors.com > > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of > > Gustav Brock > > Sent: Thursday, December 10, 2009 4:18 AM > > To: accessd at databaseadvisors.com > > Subject: Re: [AccessD] Rounding Error - A2K > > > > > > Hi Reuben > > > > There is your explanation: cur * sng returns a double. > > > > What you could do is to keep storing the percentage as a > > single. When using it for calculation, do: > > > > CurResult = CCur(CurAmount * CCur(100 * SngPercentage) / 100) > > > > This will calculate using your six decimals and (with CCur) > > round the result to four decimals. > > > > /gustav