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
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
All you want is the form NAME passed?
If so, just use:
X(Me.Form.Name)
Function X(fn As String)
.....
If so, just use:
X(Me.Form.Name)
Function X(fn As String)
.....
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
On Current
=LoadArray(Me)
On Current
=LoadArray(Me.name)