Reuben Cummings
accessd at gfconsultants.com
Fri Dec 11 09:50:04 CST 2009
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 > > > > > > >>> accessd at gfconsultants.com 10-12-2009 03:16 >>> > > Stuart and Charlotte, I'll play with the single/double issue. > > > > The dollar amounts are all currency. > > > > The percentage (.25xxx) is a single. Not sure why as this is > > the first time > > I've ever used a single. > > All these years and I've never used single and the first time > > I do it BITES > > me. > > I wanted to use currency for the percentage, but the state > > defines these > > rates to 6 decimals. > > > > Reuben Cummings > > GFC, LLC > > 812.523.1017 > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >