[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Get form name using a global variable

Posted on 2012-08-30
8
Medium Priority
?
518 Views
Last Modified: 2012-08-30
I need to be able to capture the name of a form in a global variable.  I saw one thread but it didn't make much sense to me.  Will find it and add it to this thread.  There must be a good way to get the name.
0
Comment
Question by:McGurk1
  • 3
  • 3
  • 2
8 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38350939
>I need to be able to capture the name of a form in a global variable

What form? Currently open form? All open forms? You can get to open forms using

My.Application.OpenForms

Looping through the list, you can get name of each form using .Name property
0
 

Author Comment

by:McGurk1
ID: 38351050
Worked like a dream!!   You have the points.  Can you help me with one more aspect.  How do I use this global variable to reference a control on the form.  It tells me the control is not a part of the form.  However it is and I can see it when I hold the cursor over the variable.  I am using the global variable in a second form.  When I don't use the global variable and just use the formname.control name, it does not error.  I need to use the second form to reference different forms to update them so that is why I need to use a global varialbe for the form name.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38351115
You need to CAST that form reference from a generic FORM (which is what OpenForms() returns), to the correct form type that you know it to be.

For instance, if you know that form is of type frmCatalog, then do:

    Dim cat As frmCatalog = CType(GenericFormReferenceHere, frmCatalog)

Now you can use "cat" to get to the controls that are present on the frmCatalog type.
0
 

Author Comment

by:McGurk1
ID: 38351158
Idle_Mind,
    Thank you so much.  I wish I could give you some points for this.  It works great!
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38351165
No problem.

*I wouldn't post in CLOSED questions if I was worried about points!  ;)
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38351179
Thanks for help idle_mind while I transitioned from work to home. Zone is to you now as I will spend next 3 hours in garden!
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38351199
Happy gardening!  ...fresh air and sunlight can't be found in a processor!  ;)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question