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
mattryanjerseyAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
in the On Current event of the form remove  =LoadArray(Me)
select Event Procedure from the drop down
then click on the (...)
place this in the VBA window

Private Sub Form_Current()
Call LoadArray(Me)
End Sub



0
 
Rey Obrero (Capricorn1)Commented:
remove the [ ]

On Current
=LoadArray(Me)


On Current
=LoadArray(Me.name)



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

X(Me.Form.Name)


Function X(fn As String)
.....
0
 
mattryanjerseyAuthor Commented:
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.
0
All Courses

From novice to tech pro — start learning today.