Option Button

D

dhstein

I'm using an option button to perform an action. I'm using the "MouseUp"
event and the action is working fine, but the button doesn't get the "black
dot" painted in the center. So I think I'm using the wrong event or maybe I
need to do something else. Thanks for any help on this.
 
J

Jeanette Cunningham

As mentioned in an answer to your post called Option Group, (2/3/09), the
Click event or the After update event are usually used in preference to the
mouse up event.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
D

dhstein

Jeanette,

Thanks for your reply. My memory may be going, I don't remember that post
and I just scrolled back to 2/3/09 and didn't see it there either. In
addition, neither "Click" nor "After Update" seems to be available for an
option button.
 
J

Jeanette Cunningham

The click or after update event for the option group as a whole is the
event that will put the black dot on the option you choose.
 
J

Jeanette Cunningham

The click or after update event for the option group as a whole is the
event that will put the black dot on the option you choose.
To read the value for the chosen option, use the value of the option group
as a whole.
When you click the button or checkbox that is the first option, the whole
option group has the value of 1, similarly if you click the second option,
the whole option group has the value of 2.

So if you want the second option to be chosen by VBA instead of clicking the
option button or checkbox, your code goes -->
Me.NameOfOptionGroup = 2
Then you should see that the button or checkbox for the second option is
selected.
To get more specific help on this, please describe what you are trying to do
with the option group.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
D

dhstein

Linq,

Here's the code:

Private Sub optReceived_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
ListFilesDirectory = "C:\Data\RcvFiles\"
ListFilesName = "*.xlsx"
cbxListFiles.SetFocus
End Sub


Private Sub optSold_MouseUp(Button As Integer, Shift As Integer, X As
Single, Y As Single)
ListFilesDirectory = "C:\Data\SoldFiles\"
ListFilesName = "*.csv"
cbxListFiles.SetFocus
End Sub
 
D

dhstein

These message boxes never execute. I don't understand what's going on here.



Private Sub FrameListFiles_AfterUpdate()
MsgBox Me.FrameListFiles.Value
End Sub

Private Sub FrameListFiles_Click()
MsgBox Me.FrameListFiles.Value
End Sub
 
J

Jeanette Cunningham

As we can't see your form, we only know as much as you tell us.
Most likely these is some other code on the form or its parent form that is
interferring with these option groups.

To see how option groups work without anything else getting in the way,
create a form that has only an option group on it and check the values for
the option group after update.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jeanette Cunningham

There is a working sample of an option group in the Northwind sample
database.
In A2003, click Help on the menu bar and choose Northwind - not sure where
to click in A2007.
Look on the orders form - there is an option group that uses check boxes.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Top