I was testing my code and encountered unexpected errors using VFP 9.0 sp1 function VARTYPE(). Normally it will always return the data type of the field or "U" if it does not exist.
But an error will be generated if the code references both a table and field where either the table/alias is not open or field does not exist.
That was a surprise to me. I often use VARTYPE() rather than TYPE() since it is claimed to be faster. I do not see a note about it in the Help. So is it a bug, an undocumented issue that should be listed in Help, or should I just use TYPE() whenever I'm referring to a field identified with its table/alias?
? VARTYPE(myTable.myField) && works as expected
? VARTYPE(NoTable.myField) && errors
? VARTYPE(myTable.NoField) && errors
? VARTYPE(NoTable.NoField) && errors
But an error will be generated if the code references both a table and field where either the table/alias is not open or field does not exist.
That was a surprise to me. I often use VARTYPE() rather than TYPE() since it is claimed to be faster. I do not see a note about it in the Help. So is it a bug, an undocumented issue that should be listed in Help, or should I just use TYPE() whenever I'm referring to a field identified with its table/alias?
? VARTYPE(myTable.myField) && works as expected
? VARTYPE(NoTable.myField) && errors
? VARTYPE(myTable.NoField) && errors
? VARTYPE(NoTable.NoField) && errors