Link to home
Start Free TrialLog in
Avatar of mattryanjersey
mattryanjersey

asked on

Pass the current form name to a function within a module

Hi

I am trying to send the current form name to a function when the OnCurrent event occurs. I am currently using the following code which is producing an error:

On Current
=LoadArray([Me])

and in my vba module...

Function LoadArray(FormName As Form)
    Set CurrentForm = FormName
etc
End Function

The error I am getting is "The object doesn't contain the automation object 'Me.'"

Where am I going wrong? Thanks in advance

Matt
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

remove the [ ]

On Current
=LoadArray(Me)


On Current
=LoadArray(Me.name)



Avatar of ozinm
ozinm

All you want is the form NAME passed?
If so, just use:

X(Me.Form.Name)


Function X(fn As String)
.....
Avatar of mattryanjersey

ASKER

Thanks for your ideas, unfortunately all of the above create the same error message. I cannot seem to remove the square brackets. When I type, for example =LoadArray(Me) and then leave the input box they are added back in automatically. I'm using access 97 by the way.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial