Retrieving current formname

R

Rli

In many vb routine one can refere to things with [forms]![formname]....etc.
In vb routine i want to store the formname i am in in a variable.
So i would like to use [forms]!avariablecontainingmyformname...
Can anyone tell me how to get 'your own' formname you are in?
 
D

Douglas J Steele

Forms("MyFormName")

or

strForm = "MyFormName"

and then use Forms(strForm)

From within a form, you can use Me.Name to get that form's name.
 
F

fredg

In many vb routine one can refere to things with [forms]![formname]....etc.
In vb routine i want to store the formname i am in in a variable.
So i would like to use [forms]!avariablecontainingmyformname...
Can anyone tell me how to get 'your own' formname you are in?

If the code is within the form that you are using:
strFormName = Me.Name

You can also pass Me.Name as an argument directly to a sub routine
without having to create the variable.
 
Top