How can i capture name of a form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

I am struggling to figure out just how to capture the name of an open form,
and store that name as a variable to set the open form's properties.

For example, I want to avoid using this kind of code:

---
Private Sub Form_Open(Cancel As Integer)

Dim stFrmCaption As String 'stores caption for this form

Forms!frm_ViewData_Fish_Sites.Caption = stFrmCaption

End Sub
---

I want to replace "Forms!frm_ViewData_Fish_Sites.Caption = stFrmCaption"
with a simple statement that refers to the currently open form -- regardless
of what the form's name is. This way I can create copies of the form and not
have to edit the code all the time.

What code should I use?
 
Use Me instead. (Me.Caption) BTW, the name and the caption are not the same
thing if you want the name of the form use Me.Name.
 
Hi Susan.

Thank you very much for your help. This solved my problem. :-)

Dirk
Winnipeg, Canada

------------------------------
SusanV said:
Use Me instead. (Me.Caption) BTW, the name and the caption are not the same
thing if you want the name of the form use Me.Name.
 
Back
Top