Solved

Using options

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA color chart bars 12 79
Windows 10 start screen issues 9 52
MS Date Picker 64 bit 32 bit issue 12 49
How to hault or freeze parent form when a 2d form is open in vb6 3 36
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

867 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

22 Experts available now in Live!

Get 1:1 Help Now