IIF questions with < or > signs

B

Burton

am trying to write a query in Access, but I am having problems. If I write
it like this:

IIf([Forms]![Form1]![Option22]=True,[Forms]![Form1]![Text6], "") than it
works just fine.

However, as soon as I add a > or < sign in the code, it stops working. This
is what I want it to say:

IIf([Forms]![Form1]![Option22]=True,>=[Forms]![Form1]![Text6], "").

Do you know why the > causes the query not to work? Do you know how I can
fix it?
 
V

vanderghast

The 'arguments' must be complete expression, not just part of an expression.
As example, you cannot writh:

abs( 4 + )

because that makes no sense ( the absolute value of four plus ... what? )

So, either try:


FieldOrComputedExpression >=
IIf([Forms]![Form1]![Option22]=True,[Forms]![Form1]![Text6], "")


either

IIf([Forms]![Form1]![Option22]=True,FieldOrComputedExpression
=[Forms]![Form1]![Text6], true)



If you use that statement as criteria, write it, at the first line, as
computed expression and add, as criteria line:

<> 0


(since 0 = false, and anything not null <> 0 is true)




Vanderghast, Access MVP



Burton said:
am trying to write a query in Access, but I am having problems. If I write
it like this:

IIf([Forms]![Form1]![Option22]=True,[Forms]![Form1]![Text6], "") than it
works just fine.

However, as soon as I add a > or < sign in the code, it stops working.
This
is what I want it to say:

IIf([Forms]![Form1]![Option22]=True,>=[Forms]![Form1]![Text6], "").

Do you know why the > causes the query not to work? Do you know how I can
fix it?
 
D

Dale_Fye via AccessMonster.com

Burton,

The IIF( ) function requires three parameters
1. Expression - this must be an expression that can be evaluated to True or
False
2. TruePart - this is the value you want the function to return if the
expression in Parameter #1 is True
3. FalsePart - this is the value you want the function to return if the
expression in Parameter #1 is False

The TruePart and FalsePart can be values ("A", "B", 123, ...) or they could
also be expressions (NZ(me.txt_Field1, 0) + NZ(me.txt_Field2, 0)), but you
must include both parts. In your first example, the value [Forms]![Form1]!
[Text6] evaluate properly.

When you added the >= in front of that, Access can no longer evaluate it.

HTH
Dale
am trying to write a query in Access, but I am having problems. If I write
it like this:

IIf([Forms]![Form1]![Option22]=True,[Forms]![Form1]![Text6], "") than it
works just fine.

However, as soon as I add a > or < sign in the code, it stops working. This
is what I want it to say:

IIf([Forms]![Form1]![Option22]=True,>=[Forms]![Form1]![Text6], "").

Do you know why the > causes the query not to work? Do you know how I can
fix it?
 

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