I have a function that returns a LCField. This LCField variable is not null before exiting the function, but when I get the value returned by this function from another method, the LCField variable is null. Is there any problem when you use LCField type variable as the return value of a function?
The code is as follows :
Function FileContent(strFileName As String, bolBinary as Integer) As LCField
...
...
Set Field = FieldList.Lookup("Contents")
If Field.IsNull(1) Then
Print "The field is null"
Else
Print "The field is not null"
End If
Set FileContent = Field
…
End Function
Sub ReadFileContent
...
...
Set Field = FileContent(strFileName,True)
If Field.IsNull(1) Then
Print "The field is null"
Else
Print "The field is not null"
End If
…
End Sub
The program prints :
The field is not null
The field is null
So, LCField variable loses its content when using it as the result of the function
If I use LCFieldList type variable as the result of the “FileContent” function instead of LCField, the program works correctly.
Does anybody know why?
Thanks.
Regards.