Expression with multiple arguments

B

Bill_De

I have a data base with a form for registrations. I am trying to do multiple
calculations for the registration payment based on a drop down box (Combo38
in design view) that contains three choices: Check, Credit Card, Pay Pal.
I am using an unbound control for the expression. The combo box and the
registration amount (text Box)(Text27) are built from a table so that
information is stored in my registration table. I have other unbound controls
that figure in the fees for credit cards(4%)(Text28) and for Pay Pal
(2.9%)(Text30). These figures are then entered into the registration table
using an update query.

I don't know if multiple arguments are possible and if not could someone
tell me if there is a way to calculate an expression with multiple arguments
based on a combo box. Here is the expression I have been trying and I keep
getting the error message "#NAME?"

=(IF([Forms]![tf2]![Combo38]="Check",[Forms]![tf2]![Text27]),IF([Forms]![tf2]![Combo38]="Credit
Card",[Forms]![tf2]![Text27]-[Forms]![tf2]![Text27]*[Forms]![tf2]![Text28]),IF[Forms]![tf2]![Combo38]="Pay
Pal",[Forms]![tf2]![Text27]-[Forms]![tf2]![Text27]*[Forms]![tf2]![Text30]),0)

As I write this I wonder if I should be referencing the table instead of the
form.

Any help with this please advise. This is the last hurdle I have to get over
in order to finish this data base up and getting it in use.

Thank you in advance for your help
Bill_De
 
A

Anne

Create a table for payment Method with an ID field, which should be a
primary field, autonumer.
Therefore, perhaps PaymentMethodID, could be 1 for Check, 2 for Credit Card
and 3 for paypal.
I would do all that in a query based on the registrationTable to which you
have to add the PaymentMethodID as foreign key, where you can use your iif
statement, please note the 2 ii's
FeePercent:
=iif([paymentMethodID]=1,0,iif([paymentMethodID]=2,.04,iif([paymentMethodID]=3,.029)))
If you need to store the total fee:
FeeAmount: nc([feepercent]*[salesamount},2)

Now you only need on combo on your form to select a payment method. No
update query needed.
 
B

Bill_De

This is very helpfula and I will try it out. Only one question you say to
store the total fee: FeeAmount: nc([feepercent]*[salesamount],2)

Where does that get entered? Does it go in the =iif someplace or is that a
seperate statement in anonther textbox or someplace else.

Thanks for the help
Bill_D
 
B

Bill_De

Anne,
I started working with the expressions you gave me below and I got the first
one Feepercent to work fine. However the other experssion you gave me
Feeamount when I entered it into the query and ran the query I got the
following error message: "Undefined function 'nc' in expression". When I
removed the nc the expression then worked.
Now my problem is this: When I run the query the results do not show up in
the table registration. I entered the expressions in the query in two new
fields one field Feepercent and the next field Feeamount. Did I enter these
in the wrong place. I do not need the feepercent to show up in the
registration table but I do need the feeamount to show up and I need to
subtract that from the amount paid.
My registration table has the combo box from the lookup wizard that gives me
the choices I need. I also have fields in the table for: Registrations paid
for (this is if someone pays for more than one registration), Event cost (the
cost of each registration), Fees (calculated from the expression you gave
me), and registration payment ( the amount paid minus any fees).
The query I created is a select query and to start with I just put all of
the fields from the registration table in the query.

What I need to know now that I have the expressions working is how do I get
the fees to show up in the registration table? Was I not suppose to add the
two fields with the expressions in them and put the expressions in the
existing field labled Fees or what?

I am still kind of new to Access so if you can be a little detailed I would
appreciate it.

Once I figure out how to get the fees in the registration table that should
be it. One note I will have a form that I will enter the number of
registrations paid for and the amount of the registration fees which will be
saved in the table.

Sorry about the other response I sent I just was not very clear at first on
what you were saying but once I started working it seemed to become a little
bit clearer.
Thanks
Bill_De
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top