Form not working? Expression trouble...

Thanks for telling me about the character conventions :) I've only just started using Access, I feel like I'm stumbling around in a pitch-black room.

In the example you just gave me, there are two close brackets, but only one open bracket. Will that work?

Thanks for your patience :P
 
No, my post is wrong with brackets.
Code:
iif(Condition, Value if True, Value if False)

Where is your Condition ?
 
My condition is the 'Taxable?' field, which is Yes/No. Isn't that correct? I tried your expression in my database, and Access brought up an error message that said something like 'Your expression has too many closing parenthesis', then I tried putting an opening one after the IIf {so it looked like IIf((} and that also brought up an error message.
 
I don't understand what those people are talking about. It looks like the guy who asked the question gave up in the end.

I just don't understand, this box was working yesterday, and now when I go to open it again, it's died. :s
 
My friend fixed it. All he did was delete the field on the form, then pressed Ctrl+Z. I don't know what was wrong with it. Obviously not the expression... I have no idea.
 
Try
Code:
=IIf([Taxable?]=-1,(1.1*[After Discount]),[After Discount])

Refer my post earlier about removing ? from names.

You need to clearly set your condition for Taxable?
Then state what will happen if the condition is True and what will happen if the condition is False.

Your earlier example did not appear to set out the condition.

Yes is -1 and No is 0 (zero). You need to test for one of these alternatives.
 
Sorry carrybag, was asleep.

I think PNGBill doesn't like to see IIf as part of an expression either.

=IIf([Taxable?]=-1,1.1,1)*[After Discount]

To put the expression in a query is a slightly different thing to putting it in a control's control source.

In the query window you would have:

[After GST]: IIf([Taxable?]=-1,1.1,1)*[After Discount]

Getting rid of the question mark in the fields' names is highly advisable. It will only cause problems.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom