Calculated Field Error (1 Viewer)

basilyos

Registered User.
Local time
Today, 10:16
Joined
Jan 13, 2014
Messages
252
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
 

isladogs

MVP / VIP
Local time
Today, 18:16
Joined
Jan 14, 2017
Messages
18,207
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
 

basilyos

Registered User.
Local time
Today, 10:16
Joined
Jan 13, 2014
Messages
252
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
 

isladogs

MVP / VIP
Local time
Today, 18:16
Joined
Jan 14, 2017
Messages
18,207
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
 

basilyos

Registered User.
Local time
Today, 10:16
Joined
Jan 13, 2014
Messages
252
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
 

isladogs

MVP / VIP
Local time
Today, 18:16
Joined
Jan 14, 2017
Messages
18,207
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

Top Bottom