Solved

Using options

Posted on 1998-10-04
2
140 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

831 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