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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get name of open form? 2

Status
Not open for further replies.

Tomadams

Programmer
Jun 26, 2001
141
US
I know this has got to be an old question, But I have a main selection form that will open several subforms and then the user can display a full record based upon the second form opened by the first form. I need to know the name of the second form from the third form that displays the full record. The customer wantsw to do next and previous but I need to know what the selection criteria was. It is contained in the second form.

thanks
 
This should do if for you. This will return the name of the form or subform that has the focus.

Dim CurrentForm As String
CurrentForm = Application.CurrentObjectName

If CurrentForm = "Form 1" Then
Do This
ElseIF CurrentForm = Form 2" Then
Do This
End If

HTH

-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Thanks Patrick. But he formname I am lookingfor will not have focus. It was the intermediary form before the current form. The user will be looking at data selected by the prior form. If he wants to see the next or previous data record, I have to go back to the prior (not in focus) form to get the data.
 
Why not pass the form name in the OpenArgs parameter of the OpenForm method ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Patrick, The openargs was just what I needed. thans for pointing it out. I just gave you a star.
Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top