What is the error message?
You are missing a closing paren in that expression. Parens and brackets as well as quote marks and apostrophes must always be in pairs.
But why use the second IIf()? Will 0 ever be a value in the field?
IIf([period] < 0, "BC", "AD")
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi June,
Problem solved. I was attempting to build the expression in my main table in Design View. In fact, I can only build expressions in either Forms, Queries and Reports. So I opened the control source of BCAD in Properties and built the expression as follows:
iif([txtPeriod] <0,"BC",iif({txt.period] >0,"AD",""))
Works perfectly. Cheers.
you could also just use the format property
"AD";"BC";"":""
just a thought - there wasn't a year 0 so formula just needs to be
iif([txtPeriod] <0,"BC","AD")
or formatting
"AD";"BC";"AD"
Certainly can do calcs in table with Calculated type field. Apparently, BCAD already had data and therefore could not convert to calculated field. Could have deleted and recreated the field as calculated type. Most experienced developers would recommend not using calculated field in table, however, your expression should work. It does for me.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.