While googling I found the following code snippet on this website:
It should be a code snippet that basically checks if a field exists or not. So I would expect that if that function returns true it does exist and if it returns false the field does not exist. However, the code snippet is wrong/misleading:
Set field = table.GetField(sFieldname)
If err.number = 0 Then
checkIfFieldExists = False
err.number = 0
checkIfFieldExists = True
Set field = Nothing
Now it is programmed in such way that if the field exists and no error is created (err.number =0) then it puts the boolean to false. If the field does not exists and error is raised, the error number is not equal to zero (in my case it is a negative number -xxxxx whatever) and the checkIfFieldExists boolean is set to true.
From my opinion it should be the other way round. Or?
Last seen: 3 days 2 hours ago
Joined: 11/04/2020 - 06:46