Solved Option Group wont move focus (1 Viewer)

oxicottin

Learning by pecking away....
Local time
Today, 17:22
Joined
Jun 26, 2007
Messages
659
Hello, I'm having an issue moving focus from an option group that has toggle buttons as the options which open forms and reports. The issue is lets say in my example under option 1 you click on it and it hides the frm_Switchboard form and opens Form1, this is great BUT upon closing the Form1 and setting the frm_Switchboard back to visible the option 1 is still highlighted and selected. So if I wanted to select it again I cant I have to select another option "Which would open another form or report" and then go back to option 1 and reopen it.

I have tried setting focus upon selecting an option to a hidden button Me.cmdHiddenButton.Setfocus and I tried Me.optSwitchboardGroup = 0 and Me.optSwitchboardGroup.value = 0

In my example and database I also use a function that requires using the date fields "From" and To" and moves to the control but still keeps the last option highlighted and selected.

Ideas, thoughts
 

Attachments

  • Option Focus.accdb
    436 KB · Views: 17

CJ_London

Super Moderator
Staff member
Local time
Today, 22:22
Joined
Feb 19, 2013
Messages
12,585
You can’t set focus to a hidden control, instead make it visible but set height and width to 0
 

oxicottin

Learning by pecking away....
Local time
Today, 17:22
Joined
Jun 26, 2007
Messages
659
You can’t set focus to a hidden control, instead make it visible but set height and width to 0
Sorry I named it "hidden" which is kinda misleading. I did set width to 0 which hid it in the example but it still didn't move focus
 

oxicottin

Learning by pecking away....
Local time
Today, 17:22
Joined
Jun 26, 2007
Messages
659
I created a large button to see if focus is getting moved to the button and it does BUT in the option group the toggle I selected its "Pressed Color" is still blue. Also you can not reselect it unless you select something else and go back to it.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:22
Joined
Oct 29, 2018
Messages
13,204
Hi. Can't download your file right now, but what happens if you tried this?

Me.OptionGroupName=Null
 

oxicottin

Learning by pecking away....
Local time
Today, 17:22
Joined
Jun 26, 2007
Messages
659
Hi. Can't download your file right now, but what happens if you tried this?

Me.OptionGroupName=Null

Same thing happens.... I got it working with

'Set focus to hidden control
Me.cmdHiddenButton.SetFocus
'Clear option group selection
Me.optSwitchboardGroup = ""

BUT some options on my original DB "Not test DB" stay blue from the Pressed Color but I am able to reselect it which I couldn't before.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:22
Joined
Oct 29, 2018
Messages
13,204
Same thing happens.... I got it working with

'Set focus to hidden control
Me.cmdHiddenButton.SetFocus
'Clear option group selection
Me.optSwitchboardGroup = ""

BUT some options on my original DB "Not test DB" stay blue from the Pressed Color but I am able to reselect it which I couldn't before.
Hi. Glad to hear you got it sorted out. Would you still have the same issue if you didn't use toggle buttons? Just curious...
 

oxicottin

Learning by pecking away....
Local time
Today, 17:22
Joined
Jun 26, 2007
Messages
659
Hi. Glad to hear you got it sorted out. Would you still have the same issue if you didn't use toggle buttons? Just curious...
Probably not I just wanted to try it with toggle buttons and it's probably a mistake.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:22
Joined
Feb 19, 2002
Messages
30,098
Option groups are not used this way. They are used to allow you to choose one and only one value for a bound field. The value can be red, blue, or purple. Three choices, one bound field. Think of Option Groups as a visual combobox or listbox where you see all the options available at once but you only get to choose one.

You should just use regular buttons because you are using them to control actions.
 

oxicottin

Learning by pecking away....
Local time
Today, 17:22
Joined
Jun 26, 2007
Messages
659
Option groups are not used this way. They are used to allow you to choose one and only one value for a bound field. The value can be red, blue, or purple. Three choices, one bound field. Think of Option Groups as a visual combobox or listbox where you see all the options available at once but you only get to choose one.

You should just use regular buttons because you are using them to control actions.

I was giving a different go at it... is there any examples of switchboards out there that is similar to min with a manager to maintain what appears as a button and what code it runs?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:22
Joined
Feb 19, 2002
Messages
30,098
No. Having buttons added when you update a switchboard requires a physical form change. You could build one but it would have to deal with how to resize the form if there is no place for a button. I've attached a sample with a customizable switchboard based on the concept of the original Access Switchboard. It also includes a modified version of the actual Access Switchboard based on the 2003 version (last one to use VBA rather than macros) as well as a log in form, user maintenance and a simplistic security system that allows you to assign various security options to each user and the switchboard is used to assign the security option to a form.
 

Attachments

  • SwitchboardForm20191125.zip
    1.4 MB · Views: 26

Users who are viewing this thread

Top Bottom