H
houdini
I'm trying to write a program that will find the amount of commission to pay
a sales rep. In my Input Form, I have an option group with 3 radio buttons.
The group is labled "Who Sold?", and option 1 is Listing agent, option 2 is
Another agent and option 3 is Another firm. In the Query, the field "Who
Sold?" contains the number 1, 2, or 3 depending on what was selected in the
Input Form. There is another file in the Query called "Total Commission".
This is the Commission collected by the Company, and is split with the Sales
Rep. as either 25 or 50%. The file that I'm trying to put in a conditional
"If" statement is "Agent's Commission". Deprnding on whether 1, 2, or 3 is in
"Who Sold?" the "Agent's Commission" should be 1/4 or 1/2 of the "Total
Commission". For some reason, Access requires an "IIf" instead of "If". Most
other programs use "If". The statement I'm trying to write into the Agent's
Commission file is: " If Who Sold? is 1 then divide Total commission by 2,
else if Who Sold? is 2 then divide Total Commission by 4 else if Who Sold? is
3, divide Total Commission by 4. End if.
I've tried writing this a number of different ways. One is:
Agent's Commission=IIf([Who Sold?]=1 Then[Total Commission]/2,
ElseIIf [Who Sold?]=2 Then[total Commission]/4 ElseIIf [Who Sold?]=3
Then[Total Commission]/4) End IIf
Another is:
Agent's Commission=IIf(([Who Sold?]=1 [Total Commission]/2), ElseIIf ([Who
Sold?]=2 [total Commission]/4) ElseIIf ([Who Sold?]=3 [Total Commission]/4))
End IIf
I've tried using the Expression Builder function in the Design mode of
Query. In the Expression builder, on the bottom left, click on "Functions",
and when it open, click on "Built in Functions". This opens a group of
functions on the far right. Scroll down to the "IIf", and click on it. When
you do, at the top of the Expressions Builder Window, it will have a formula
that looks like:
<<expr>>IIf(<<expr>>,<<truepart>>, <<falsepart>>)
I've tries substituting values in there, and they still come back with an
error message. At this point, I'm really getting frustrated. I know that
there's some little thing I'm doing wrong that keeps it from working, but I
can't seem to be able to find it. I really need help.
a sales rep. In my Input Form, I have an option group with 3 radio buttons.
The group is labled "Who Sold?", and option 1 is Listing agent, option 2 is
Another agent and option 3 is Another firm. In the Query, the field "Who
Sold?" contains the number 1, 2, or 3 depending on what was selected in the
Input Form. There is another file in the Query called "Total Commission".
This is the Commission collected by the Company, and is split with the Sales
Rep. as either 25 or 50%. The file that I'm trying to put in a conditional
"If" statement is "Agent's Commission". Deprnding on whether 1, 2, or 3 is in
"Who Sold?" the "Agent's Commission" should be 1/4 or 1/2 of the "Total
Commission". For some reason, Access requires an "IIf" instead of "If". Most
other programs use "If". The statement I'm trying to write into the Agent's
Commission file is: " If Who Sold? is 1 then divide Total commission by 2,
else if Who Sold? is 2 then divide Total Commission by 4 else if Who Sold? is
3, divide Total Commission by 4. End if.
I've tried writing this a number of different ways. One is:
Agent's Commission=IIf([Who Sold?]=1 Then[Total Commission]/2,
ElseIIf [Who Sold?]=2 Then[total Commission]/4 ElseIIf [Who Sold?]=3
Then[Total Commission]/4) End IIf
Another is:
Agent's Commission=IIf(([Who Sold?]=1 [Total Commission]/2), ElseIIf ([Who
Sold?]=2 [total Commission]/4) ElseIIf ([Who Sold?]=3 [Total Commission]/4))
End IIf
I've tried using the Expression Builder function in the Design mode of
Query. In the Expression builder, on the bottom left, click on "Functions",
and when it open, click on "Built in Functions". This opens a group of
functions on the far right. Scroll down to the "IIf", and click on it. When
you do, at the top of the Expressions Builder Window, it will have a formula
that looks like:
<<expr>>IIf(<<expr>>,<<truepart>>, <<falsepart>>)
I've tries substituting values in there, and they still come back with an
error message. At this point, I'm really getting frustrated. I know that
there's some little thing I'm doing wrong that keeps it from working, but I
can't seem to be able to find it. I really need help.