Access 2010 (Iff Statement)

I have the following iff statement.

=IIf(([OctPayStatus]="0") And ([OctPayment]>"0"),"Unpaid","Paid")

OctPayStatus is a checkbox and OctPayment is a numeric value.  I am trying to get the following answered:  If the OctPayStatus is not checked and OctPayment has a value greater than 0 then show Unpaid else show paid.

Access tells me I have a circular reference on the control property......

A little push would be greatly appreciated.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:

=IIf([OctPayStatus]=0 And [OctPayment]>0,"Unpaid","Paid")


=IIf([OctPayStatus] <> 0 And [OctPayment]>0,"Paid","Unpaid")
bobmillingtonAuthor Commented:
Ok, tried this code as sugguested..

=IIf([OctPayStatus]=0 And [OctPayment]>0,"Unpaid","Paid")

It returns the Paid records ok, but the unpaids show #Type! where "Unpaid" should be.  Also, the control box tells me of a cirular reference.

I dont understand it.  I tried this code =IIf([OctPayStatus]=0,"Unpaid","Paid") and it shows the right values......its when I add the and part it fails.
bobmillingtonAuthor Commented:
Looks like the problem is with the OctPayment field.  I tried

=IIf([OctPayment]=0,"No Value","Value")

and I get the same #type! error.  The OctPayment field is a currency field....just doesn't make sense.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Jeffrey CoachmanMIS LiasonCommented:
OctPayment may be NULL
(Null is not the same as zero)

So try
=IIf(IsNull([OctPayment]),"No Value","Value") a test

If this is the issue, I am sure capricorn1 can get you sorted the rest of the way...
(so no points wanted for me)


Rey Obrero (Capricorn1)Commented:
< Also, the control box tells me of a cirular reference.>

try renaming your controls.. for textboxes  add "txt" in front..
if the current name of the control is "Unpaid", change the name to "txtUnpaid" (without the quotes )

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobmillingtonAuthor Commented:
I just put txt in front of the control name and it magically worked.   The syntax in the expression builder was good afterall.

Many Thanks!!!!!

=IIf(([OctPayStatus]=0 And [OctPayment])<>0,[OctPayment],"0")
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.