Solved

Using options

Posted on 1998-10-04
2
148 Views
Last Modified: 2010-04-30
how do I get option buttons on my main form to open any of the other forms in my project.  ie: main form has options search, generate, random encounter and I wish to open the corersponding forms. However I get  a message telling me that method not valid using if - else.  All help appriciated
0
Comment
Question by:ARROWTHORNE
2 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
ID: 1438076
Arrowthorne,
Assume you have 3 option buttons named optSearch, optGenerate, optRandom , coresponding to 3 forms named: frmSearch, frmGenerate, frmRandom,
Now you drop a command button name cmdOpen.  in the cmdOpen_click Event, add:
On error goto trap

'Hide (or Unload) previously loaded form
frmSearch.Hide
frmGenerate.Hide
frmRandom.Hide

If optSearch.Value = True then  frmSerch.Show
If optGenerate.Value = True then  frmGenerate.Show          
If optRandom.Value = True then  frmRandom.Show
     
Exit sub
Trap:
Err.clear
Resume Next


You can also put the option buttons to a control array.
so you would have optOpen (0), optOpen (1)  optOpen(2)
 
Then you can add the code in the optOpen_click event:

On error goto trap
'Hide (or Unload) previously loaded form
frmSearch.Hide
frmGenerate.Hide
frmRandom.Hide

Select Case Index
     Case 0
            frmSerch.Show
     Case 1
            frmGenerate.Show      
     Case 2    
            frmRandom.Show
     End Select
     
Exit sub
Trap:
Err.clear
Resume Next

Regards
Dalin
0
 

Author Comment

by:ARROWTHORNE
ID: 1438077
Again thanks for the assistance.
Col
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

733 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