?
Solved

Load form with the use of variables

Posted on 2002-05-23
5
Medium Priority
?
148 Views
Last Modified: 2010-05-02
Hi Experts,

I am facing a problem in loading forms in VB, by calling the form name through a variable. Like :

dim ank as string
ank = "frmMain"
Load ank

the above code is giving me problems and I am unable to figure out a way to get past this problem. I think that the solution would be easy for you experts with years experience but silly me could not get through this small problem. I would really appreciate all the help I can get with this problem of mine.

Chalo that will be all for now. TAKE CARE you guys and gals.

Thanks in advance. :):):)

Joyriderank.
0
Comment
Question by:joyriderank
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7029260
unfortunately, even we with years of experience don't have anything except workarounds for this problem. Unless the form is not loaded, you can't get it's object reference and check it's name, and thus you can't load one (as the load function requests an object).
CHeers
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 200 total points
ID: 7029277
angelIII you can use this of course:

Dim frmToLoad As Form
dim ank as string
ank = "frmMain"
Set frmToLoad = Forms.Add (Ank)

which does work. Of course if the string contains a form that is not present in the project then an error will occur but this can be trapped and handled in the usual way.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7029279
sorry, you are right... but this is new in VB6, I start to loose my vb-knowledge, doing too much stuff in db :(
CHeers
0
 
LVL 1

Author Comment

by:joyriderank
ID: 7030045
Thanks for your help with the problem guys. I will check out your suggestion TimCottee and get back to you if I face any problems.

Chalo that will be all for now. TAKE CARE guys. :):):)

Joyriderank.
0
 
LVL 1

Author Comment

by:joyriderank
ID: 7036422
Thanks TimCottee for the answer. It wroked just great. Thanx a lot for the advice.

Take Care.

Joyriderank.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, left to enroll

770 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