In a report we have in our project, we receive fields in each record that must be placed on their own line, but within the same column. For example, if we have 4 maintenance codes in the current record, we must show them in the same column. So, we must add a VbCrLf to the end of each field, then show the next one on the line beneath.
However, we cannot be sure which of the 4 may be null; therefore, we added a function to the Custom Code of the report (see attached code snippet). We intended this function to clear empty lines from a column when no value was available. If we just used the expression
=Fields!Value1 & VbCrLf & Fields.Value2 & VbCrLf ....etc...
then we'd end up with blank lines where the fields had no value. So, we wrote the function below:
'BEGIN CODE----------------------------------------
Public Function FmtRptField(ByVal input As String) As String
Dim szResult As String = ""
If input.length > 0 Then
szResult = input & vbcrlf
End If
Return szResult
End Function
'END CODE------------------------------------------
When we attempt to use the function in the Expression property of the field in question, we keep getting an 'Unrecognized Identifier' error, as if the function did not exist, as if it had never been added to the Code tab of the report. Of course when the report is run in the program, we get the ever-popular '#Error' string as our column value.
Question: WTF???
However, we cannot be sure which of the 4 may be null; therefore, we added a function to the Custom Code of the report (see attached code snippet). We intended this function to clear empty lines from a column when no value was available. If we just used the expression
=Fields!Value1 & VbCrLf & Fields.Value2 & VbCrLf ....etc...
then we'd end up with blank lines where the fields had no value. So, we wrote the function below:
'BEGIN CODE----------------------------------------
Public Function FmtRptField(ByVal input As String) As String
Dim szResult As String = ""
If input.length > 0 Then
szResult = input & vbcrlf
End If
Return szResult
End Function
'END CODE------------------------------------------
When we attempt to use the function in the Expression property of the field in question, we keep getting an 'Unrecognized Identifier' error, as if the function did not exist, as if it had never been added to the Code tab of the report. Of course when the report is run in the program, we get the ever-popular '#Error' string as our column value.
Question: WTF???