I tried setting the decimal places to 2 in the table and yet my results are
still rounded to the nearest whole number. I don't know how to fix this
problem.
Please help.
--
Build a little, test a little.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Weeble" <Wee...@discussions.microsoft.com> wrote in message
news:435A0166-C727-44B0...@microsoft.com...
Any ideas?
"Douglas J. Steele" wrote:
> .
>
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Weeble" <Wee...@discussions.microsoft.com> wrote in message
news:8B3AB476-17A0-44EF...@microsoft.com...
Here is a sample of the code that I am using to calculate a bonus amount:
If Qnty >= 600 And Qnty <= 699.99 Then
BnsAmnt = 0.25
ElseIf Qnty <= 799.99 Then
BnsAmnt = 0.5
ElseIf Qnty <= 899.99 Then
BnsAmnt = 0.75
ElseIf Qnty <= 999.99 Then
BnsAmnt = 1
If the amount is less that 0.51 my control is rounding down to 0. If the
amount is 0.51 or greater it is rounding to 1.
The control is set to a "Currency" format with the decimal places set to 2.
I don't know what else to look at.
The calculations are being made in a module and being shown in an unbound
control on a form. I will not be storing this data at this time but it will
become important later as I complete my project.
Any help would be greatly appreciated. Thanks.
"Douglas J. Steele" wrote:
> .
>
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Weeble" <Wee...@discussions.microsoft.com> wrote in message
news:FD4F3F43-5BBF-4B76...@microsoft.com...
> Douglas,
>
> Here is a sample of the code that I am using to calculate a bonus
> amount:
>
>
> If Qnty >= 600 And Qnty <= 699.99 Then
> BnsAmnt = 0.25
> ElseIf Qnty <= 799.99 Then
> BnsAmnt = 0.5
> ElseIf Qnty <= 899.99 Then
> BnsAmnt = 0.75
> ElseIf Qnty <= 999.99 Then
> BnsAmnt = 1
>
> If the amount is less that 0.51 my control is rounding down to 0.
> If the amount is 0.51 or greater it is rounding to 1.
>
> The control is set to a "Currency" format with the decimal places
> set to 2. I don't know what else to look at.
>
> The calculations are being made in a module and being shown in an
> unbound control on a form. I will not be storing this data at this
> time but it will become important later as I complete my project.
>
> Any help would be greatly appreciated. Thanks.
>
In the module, usually right below the module declaration, you need
to declare the variable and set it to 0.
Dim BnsAmnt as double
BnsAmnt = 0
Also, your test for >= 600 is not logical. Say Qnty = 500.
the If rejects it (>=600), so the code moves to the first ElseIf,
which accepts it, because it does not know about the lower limit in
the statement above..
you can either move the first test to a separate line
If Qnty < 600 Then
' do nothing
ElseIf Qnty < 700 then
BnsAmnt = 0.25
etc
--
Bob Quintal
PA is y I've altered my email address.
You were both on the money about my creating the problem myself. I was
overlooking that I had set my variable "BnsAmnt" as an Integer instead of
Double. I feel like such an idiot after all the time I spent on this. Thanks
so much for all your help. I guess I couldn't see the forest for the trees.
"Douglas J. Steele" wrote:
> .
>