Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

toggle buttons are giving me GRIEF

Status
Not open for further replies.

trayb

Programmer
Sep 30, 2002
25
0
0
US
Is it possible to make a toggle button behave like a command button? I have toggle buttons in an option group and I'd like to generate some type of click event that opens a form based on the selected option, BUT, and here's the catch, I need to reference the selected option number/choice (there's underlying code that's dependent on the option group value selected.)

For example, I want to click on toggle1 and open Form1, then from Form1 I can still make a reference to my open option group form as well as the selected option group value. eg. Forms!optForm!optGroup.Value

I'm currently able to do this but I have to use a "GO" command button to trigger any action. What I'm trying to do is to be able to click directly on the toggle button and open the corresponding form.

Most of the code is in place so I'm trying not to "re-invent the wheel". I've tried using the toggle button's mouse up event but that gives me unpredictable results. There's GOT to be a better way. Anyone know what it is?

 
Each toggle button in the option group has a value. See the properties of each. You can re-set them to any value that you want. In the AfterUpdate event procedure of the Option Group is where you put your code to open a form. There is also an OnClick event there but they may act a little different as toggle1 may already be selected and the user clicks it again. Well you may already have your form opened up. So, the AfterUpdate serves a little better function for you here.

You can use:
Select Case me.OptGroup
Case 1
DoCmd.OpenForm "frmYourForm"
Case 2
'Code
Case 3
'Code
End Select

Let me know if this explaination is useful.

Bob Scriver
 
Yep, that was the missing link alright. Thanks for the tip Bob. It works like a charm now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top