Which is the "active" userform

Hi all,
I use the = new syntax when I display a userform.  e.g.

I have built a form called Frm_Status

In my stanndard code :
Dim F_Status as Frm_Status
set F_Status = new Frm_Status

So I am creating a new object called F_Status that is a copy of Frm_Status.

When I am in the Sub that "set" the userform, I can update F_Status and adjust it by  addressing it as F_Status.controlname .  However, in a different called Sub, I can't address the active F_Status form that is displayed.

I can find it by:
For Each oForm in Userforms()

but is there another way?

Hope this is clear ...

Thanks!
RODELSAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Couldn't you pass the new instance you've created to the other sub, just as you would with any other variable/object.
0
dlmilleCommented:
Alternatively, you could create a public variable, rather than a local variable, as follows

Public F_Status as Frm_status

and comment out your current declaration.  That should give you an opening to engage the userform.

Dave
0
RODELSAuthor Commented:
Hi guys,
Thank you for the suggestions - neither of which worked.

I solved it myself using the following steps:
1) Created a public variable called goActive_Userform as msforms.userform

Then in the Initialise Form event -
set goActive_Userform = Me

Then in the calling module, refer to the form via goActive_Userform.controls( whatever

This seems to work.

Kind regards,
Robert
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NorieAnalyst Assistant Commented:
Robert

How did you try what was suggested?
0
RODELSAuthor Commented:
It seems to work
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.