Calculated Field Error

basilyos

Registered User.
Local time
Today, 01:21
Joined
Jan 13, 2014
Messages
256
hello guys,


what's the problem with this expression


Code:
IIf(IsEmpty([Sin01_Code]);;IIf(IsEmpty([Sin02_Code]);[Sin01_Code]);IIf(IsEmpty([Sin03_Code];[Sin01_Code] & " - " & [Sin02_Code];[Sin01_Code] & " - " & [Sin02_Code] & " - " & [Sin03_Code])))


am getting this error
The expression you entered has an invalid . (dot) or ! operator or invalid parentheses
You may have entered an invalid identifier or typed parenthesis following the Null constant
 
Normally you use commas rather than semicolons to separate the different parts of an expression though this can depend on your location

You have a DOUBLE semicolon near the start - I think you need to add an empty string between these .... or possibly change to a single comma / semicolon if you still get an error
 
i can't seperate with comma just with semicolon
after adding empty string between the first two semicolon
i get this error

The expression you entered has a function containing the wrong number of arguments
 
Just read it again - fairly sure it should just be a single semicolon. Try it.

As you realise it gets very hard to read/debug when you have more than 2 nested IIf statements
 
i changed to


Code:
IIf([Sin01_Code] Is Not Null And [Sin02_Code] Is Not Null And [Sin03_Code] Is Not Null;[Sin01_Code] & " - " & [Sin02_Code] & " - " & [Sin03_Code];IIf([Sin01_Code] Is Not Null And [Sin02_Code] Is Not Null And [Sin03_Code] Is Null;[Sin01_Code] & " - " & [Sin02_Code];IIf([Sin01_Code] Is Not Null And [Sin02_Code] Is Null And [Sin03_Code] Is Null;[Sin01_Code];"")))


everything work but still don't now where is my fault in the first expression
 
Did you try removing the extra semicolon which I said to remove?
Including that gave one argument too many.

However, I was going to suggest using Nz instead of Is Empty.
In future I would suggest avoiding multiple nested IIf statements - use a function instead e.g. with Select Case statements
 

Users who are viewing this thread

Back
Top Bottom