Is there a way to determine the Object type, when passing a reference to a function?
I’m using a security permissions function, which determines if the user has permission to view/edit the Form passed to it by reference. I’d like to expand this to include reports as well.
To keep the function generic, I’d like to pass a ref for either a Form or a Report as an Object, eg:
function gfSecurity_Permission(obj as Object)
However, I’d need to determine the type of the object within the function.
Does anyone know of a way to do that?
MTIA
VBA has two functions: TypeName and TypeOf (TypeOf does not have a VBA documentation article, but the function exists nonetheless).
However, for a good example of their use, you can refer to the Determining Object Type article from the VB.NET documentation.