|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I want a option button to be selected (looks like a light bulb when changed the color to green) when the filter is on. I have a combobox for the filter to occur. I'm thinking.. do I put the condition in "OnFilter" section in the properties?... But I don't know what the code is to "select" the option button so that the "black" dot appears in the circle. Thanks! |
|
#2
|
|||
|
|||
|
Not sure if I understood exactly what you want, but as far as the option group with radio buttons (circles with a black dot), each "circle" has a value...generally starting at 1 by default and incrementing from there unless you have changed the value for them. So you can set the item or circle to show a dot by simply stating the value for the option group. i.e OptionGroup.Value = 1 would place a black dot in the circle to the item that has a value of 1. You can place this in any event for which you want it to trigger. Be sure to use the actual name of the option group. Now for the rest of your post "looks like a light bulb when changed the color to green"??? Lost me on that one.
lwells |
|
#3
|
|||
|
|||
|
Ok, so I have a combobox that has a macro that applies filters (ApplyFilter). I want the optiongroup to have a value of 1 (OptionGroup.Value=1) ... so that it has a black dot in it. Is that possible?
Thanks |
|
#4
|
|||
|
|||
|
That is correct. In the After Update of your combo box, place your code in the forms module (Click on the elipse button "..." next to the dropdown arrow when your curser is in the textbox for the AfterUpdate Event and select code builder) for that event. Now you will need to identify which radio button (if you have more than one) you want to have a black dot in it. So you will have to make some adjustments in how you will identify what was selected in the combobox to determine which radio button will have a black dot in it. There are several different ways to do this, but what I would recommend is to use the bound column of your combobox to identify what radio button goes with what is selected using the Select Case method.
Select Case Combobox - use the name of your combo box Case "Whatever is in the bound column here" OptionGroup.Value = 1 Case "Whatever is in the bound column here" OptionGroup.Value = 2 ... etc. End Select There are several other methods that can be used, but this might be the easiest to do. If you only have one radio button, (used to visually identify that a filter is on), then all you would need is to do is place the code OptionGroup.Value = 1 in the AfterUpdate event of the combobox. Make sure that the value of the radio button is 1 and make sure you use the name of your option group in the code where I have it in bold. lwells Last edited by lwells : January 20th, 2005 at 03:14 PM. |
|
#5
|
|||
|
|||
|
"If you only have one radio button, (used to visually identify that a filter is on), then all you would need is to do is place the code OptionGroup.Value = 1 in the AfterUpdate event of the combobox. Make sure that the value of the radio button is 1 and make sure you use the name of your option group in the code where I have it in bold."
This is exactly what I want... I tried it out, but it doens't work. Why? I placed the OptionGroup.Value=1 (with my own option radial button name: FilterIndicator) in the AfterUpdate section of the combobox properties. But it doesn't do anything to the radial button when I filter my records. Why? Thanks |
|
#6
|
|||
|
|||
|
My apologies, I need to be more specific for you. You need to use the name of the option group itself, not the name of the radio button. Typically this will be the square or rectangular frame that access by default places around the group of radio buttons. Generally by default, access gives this the name of Frame1 etc. What you want to do, is select the frame that is around your option group in design view, then in properties find out what name access assigned to the option group as a whole and use that name in the procedure. The value that the radio button itself, which is a number will be what you place after the equal sign.
OptionGroup = OptionGroupButton.Value In other words, you are telling access that the option group has a button with a specific value that you want to assign. So if the option group is the first option group that was put on your form, it most likely will have the name Frame1 unless you have changed it. The value of the radio button, will generally be 1, unless you have changed it. So the syntax would look like Frame1.Value = 1 meaning the option group as a whole will equal the value of one specific button that you want. lwells Last edited by lwells : January 21st, 2005 at 10:41 AM. |
|
#7
|
|||
|
|||
|
I have found the name, but it's Frame28.. I think it's because i have other option groups in my form.. but anyways.. I put Frame28.Value=1 in the AfterUpdate part of the combobox, and i tried it out.. but it has a pop up saying it cannot find the macro 'Frame28'... i tried putting "=Frame28.Value = 1" in the AfterUpdate, but it does not work...
what can I do next? |
|
#8
|
|||
|
|||
|
Ahh...you need to put this in the code window. When you place your curser in the textbox next to the AfterUpdate a little arrow will appear on the right side. Next to the arrow will be the elipse button. Thats a button with three little dots "..." Click on that button and it will open a menu. Select Code Builder. This will open the code window with the curser placed between two lines First Line will be Private Sub and the last line will be End Sub. Place your code between these two lines. Frame28.Value = 1
That should take care of it. lwells |
|
#9
|
|||
|
|||
|
oh.. it works now.. thanks.. but one thing is weird.. i put the radial button name (ie. Option319) rather than the "Frame28" and it works..
Thanks very much |
|
#10
|
|||
|
|||
|
The call can be made to the button as well, but normally I like to make the call to the group as a whole. Being consistent when writing code throughout your application will make it much simplier down the road when you need to make changes or add additional code. You will find many different ways to perform specific actions when writing code. Some ways are more efficient than others and others are just a matter of preference. My preference is to call the group as a whole rather than the individual control. So whatever method you prefer to use will be okay.
lwells |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Select a option button when filter is on |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|