J
Jonathan Scott via AccessMonster.com
I am writing a function that returns a TableDef, and when there is no
TableDef to return, I try to return Null. Problem is I get a "Object
required" error when I try to assign Null to the function name.(actual
error message is in Japanese, sorry if the error message is not exactly the
same in English)
Fine. I will just catch the error, and return without assigning anything.
But wait, IsNull() is not correctly detecting what should have been a Null
return value!
The compiler likes my assigning a Null for return. Why doesn't the runtime?
Public Function getTable(thisDB As TableDefs, thisTableName As String) As
tableDef
On Error GoTo getTable_ERROR
Set getTable = thisDB(thisTableName)
Exit Function
getTable_ERROR:
Set getTable = Null
End Function
Jonathan Scott
TableDef to return, I try to return Null. Problem is I get a "Object
required" error when I try to assign Null to the function name.(actual
error message is in Japanese, sorry if the error message is not exactly the
same in English)
Fine. I will just catch the error, and return without assigning anything.
But wait, IsNull() is not correctly detecting what should have been a Null
return value!
The compiler likes my assigning a Null for return. Why doesn't the runtime?
Public Function getTable(thisDB As TableDefs, thisTableName As String) As
tableDef
On Error GoTo getTable_ERROR
Set getTable = thisDB(thisTableName)
Exit Function
getTable_ERROR:
Set getTable = Null
End Function
Jonathan Scott