Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get form name

Status
Not open for further replies.

mdieckman

MIS
Nov 21, 2006
88
US
I thought I posted this yesterday, but I couldn't find my thread. Is there a function either in VBA or on the macro form that I can use that would return the name of the open form?

Thanks in advance.
 
g'day fella,

There may be more than one form open of course. consider something like:

Code:
dim frm as form
dim stropen as string

for each frm in forms
   if frm.isopen then
      strOpen=strOpen & ", " &frm.name
   endif
next frm

if nz(strOpen,"")<>"" then
   msgbox "These forms open: " & stropen
endif

not tested but could give you some hints,

good luck,

JB
 
If you wish to know the name of the active form:

Screen.ActiveForm.Name

You will get error 2475 if there is no active form.

On the form itself or in the form properties, Name, [Name] and Me.Name variously suit.
 
Thank you guys. It was really as simple for me of creating a text box with the value of =form.name
 
Form is not essential. =[Name] will work, which is one reason why Name is such a bad name for fields and controls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top