Solved

Using options

Posted on 1998-10-04
2
131 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
Comment Utility
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
Comment Utility
Again thanks for the assistance.
Col
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now