?
Solved

Using options

Posted on 1998-10-04
2
Medium Priority
?
162 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
[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 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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