Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coming from VBA - Is there a function which returns object type

Status
Not open for further replies.

SBendBuckeye

Programmer
Joined
May 22, 2002
Messages
2,166
Location
US
I have a function which takes in an object parm and sets a reference to a form. I made the parm variant so I could handle either a string form name or a form object. I want to use something like the following:

Private mfrm As Form 'Module level declaration

If IsObject(Parm As Variant) Then
If Parm Object is a form Then
Set mfrm = Parm
Else
Report error since incorrect object type
End If
Else
Set reference to form using string form name
In VBA this would be the following:
Set frm = Forms(Parm) 'Add to open forms collection
End If

How do I determine if the object is a form for an object parm and how do I set the reference of a string parm. I want to put the above code in a DLL and call it from an Access97 application.

Any help would be greatly appreciated!

Have a great day!
 
Checkout the TypeOf keyword in VBHelp
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks, I had checked that but didn't see anything that referenced a form. Did I miss something or can't I check that in VB the same way I would within the Access application?

Thanks again for the help!
 

You can check for a form with something like...

[tt]
If TypeOf Object Is Form Then
[/tt]

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top