Full Version: I get a type mismarch when I want to pass an object to a procedu
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
eurob
I have a form and I would like to pass this form to a procedure in a module.

Dim frmObject As Form
Set frmObject = Me
UpdateFields (frmObject) <---------- What is wrong with this call ?


Public Sub UpdateFields(frmObject As Form)
MsgBox frmObject.Name
End Sub

I get a 'runtime error 13, Type Mismatch'.

Appreciate some help.

robert
eurob
I got it.

I need to change the call UpdateFields (frmObject) to

UpdateFields frmObject


without the brackets.
MicroE
FYI – you do not need to declare the frmObject – it is an argument in your Procedure.

Instead of:
Dim frmObject As Form
Set frmObject = Me
UpdateFields frmObject

You can simply code:
UpdateFields Me
eurob
cool, thanks
MicroE
You're Welcome
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.