Here are two ways of looking at it. If you want to add the attribute for LAND_AC6 only when none of the other fields have any attributes, then use this.
Function FindLabel ( [LTSA_LOT] , [LTSA_BLOCK] , [LTSA_PA4] , [LTSA_PLAN] , [LAND_AC6] )
if ( Len ([LTSA_LOT]) <> 0) then
str = [LTSA_LOT] & " - "
end if
if ( Len ( [LTSA_BLOCK] ) <> 0) then
str = str + [LTSA_BLOCK] & " - "
end if
if ( Len ( [LTSA_PA4] ) <> 0) then
str = str + [LTSA_PA4] & " - "
end if
if ( Len( [LTSA_PLAN] ) <> 0) then
str = str + [LTSA_PLAN]
end if
if ( Len( [LAND_AC6] ) <> 0) then
str1 = [LAND_AC6]
end if
if (Len(str) > 0) then
FindLabel = str
else
FindLabel = str1
end if
End Function
If you want to add the attribute for LAND_AC6 if one or more of the other fields don't have any attributes, then this should work
Function FindLabel ( [LTSA_LOT] , [LTSA_BLOCK] , [LTSA_PA4] , [LTSA_PLAN] , [LAND_AC6] )
dim found
found = True
if ( Len ([LTSA_LOT]) <> 0) then
str = [LTSA_LOT] & " - "
else
found = False
end if
if ( Len ( [LTSA_BLOCK] ) <> 0) then
str = str + [LTSA_BLOCK] & " - "
else
found = False
end if
if ( Len ( [LTSA_PA4] ) <> 0) then
str = str + [LTSA_PA4] & " - "
else
found = False
end if
if ( Len( [LTSA_PLAN] ) <> 0) then
str = str + [LTSA_PLAN]
else
found = False
end if
if ( Len( [LAND_AC6] ) <> 0) then
str1 = [LAND_AC6]
end if
if found then
FindLabel = str
else
FindLabel = str & vbNewLine & str1
end if
End Function