Uncheck an Option Group

I have an option group with two values assiciated with it , 1 or 2. Sometimes users mistakenly choose one option but then they like to clear the selection. If the record is not saved, hitting escape key can achieve this but once the record is saved, you can only select one of the two optioons. I was wondering how to reset the option group.

Sponsored Links:

I have a report that's based on a query whose form has an option group. The Options (and Values) are N/A (0), Yes (1) and No (2). I have the option group set to store the numeric value in the table. I need to report the average of the option group without including the N/A's.

I need three records with the results of "Yes", "No" and "N/A" to return an average of "1.5", not "1". Any suggestions? It's still early in the developement of the db, so I'm open to making changes on any object.

I am trying to make a code for an Option group so that when the option button is selected it makes certian comoboxes visible=false. I did this but it does not work. I cant remember how to do it. Please help
Daniel This is what i did

Private Sub frmSearch_BeforeUpdate(Cancel As Integer)
If optAddress.Value = 1 Then
cboAddress.Visible = False
ElseIf optWorkorder.Value = 2 Then
cboWorkorder.Visible = True
ElseIf optName.Value = 3 Then
cboName.Visible = True
End If
End Sub

I have a form with unbound fields and using an option group (gStartStop) with two buttons, Start/Stop, I want to control the execution of a DO WHILE loop where a series of actions are performed, including action queries.

Code of the option group:

	Private Sub gStartStop_AfterUpdate()
    If Me.gStartStop = 2 Then 'START button is pressed
        Call XYstat
        Me.gStartStop = 1 'STOP button is pressed
    End If
End Sub

Partial Code of the XYstat(), the loop:

	Do While Me.valStartDraw > dblStopDraw And Me.gStartStop = 2 '"START"
    Call cmdGetRDraws_Click
    'Show counter
    Me.txtCounter = "CurDraw: " & Me.valStartDraw & vbNewLine & "LoopNo: " & lnCnt
    Me.cmdGetRDraws.Enabled = False
'Create currend bunch of X,Y records
DoCmd.SetWarnings False
    'Empty table
    DoCmd.RunSQL "DELETE * FROM tblRecordsXY"
    'Calculate and append respective records
    DoCmd.OpenQuery "AnalAppendXYrecs", acNormal, acEdit


The problem is that when I click on the STOP button to terminate the loop, I get the error Quote: The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing Microsoft Office Access from saving the data in the field. (kindly see the attachment for the full error) and after I press OK the loop continues and finishes normally, doesn't exit.

Anybody with enough experience can tell me what I'm doing wrong?

Thank you!

I have an option group that selects what is printed on a report.
Is there anyway that the user can save their options to use at a later date.



How can one highlight the acitve control in an option group? The option group in this case has three elements. Others, however, have more which means the solution would need to be generic. I assume this would actually be the label to the check button since the check button can't be highlighted.

What I have been doing is highlighting the entire frame, but this doesn't seem to be the elegant solution and it is still difficult to see which check box was actually selected.

	Private Sub Frame83_Enter()
    Call Enter_Control
End Sub

Sub Enter_Control()
    With Me.ActiveControl
        .Properties("borderwidth") = 4
        TMPCLR = .Properties("bordercolor")
        .Properties("bordercolor") = BORDERCLR
        End With
End Sub

Private Sub Frame83_Exit(Cancel As Integer)
    Call Exit_Control
End Sub

Sub Exit_Control()
    With Me.ActiveControl
        .Properties("borderwidth") = 1
        .Properties("bordercolor") = TMPCLR
        End With
End Sub

You know that viewing a form in design mode, when you select an option group, the selection includes automatically all group elements (bound, options, labels...). My question is,

That can be done in VBA?. I mean to select a group of controls together (in my case, a whole option group) in order to do an action to all the controls at the same time (in my case, to move it).

Thanks in advance for your help!!

Trust me I have looked through all my manuals and having been browsing the 'net for quite a while to get help with this and haven't found anything.

I am using Microsoft Office 2003 with Visual Basic 6.5 and need to learn how to write the code which will create an option group an name the buttons based on values in a table.

For example, I have developed a database to tally the scores/results for a Track & Field day. The program is good to go, but if the organizers decide to add or delete some of the events this will require some redeveloping. So for an option group that I have where users may select an event, I would like to know how to write the code to create this option group programmatically.


I've been working on a db and need a little help. I have a table that includes a column that will only ever have one of three words in it: Driver, TD, or Both. I am using this table to create a report and need to filter it by the before mentioned text in one of two ways, either: Driver and Both, or TD and Both. I would like to do this through a userform that has an option group with two radio buttons: Driver and TD. I don't have "Both" in the option group because this will always be a part of the filter criteria. My problem is that I can't figure out how to use this option group with the criteria field in the query. Originally I had: [Enter Driver or TD:] or "Both". This required me to type in Driver or TD each time to achieve my results. It works perfectly, but I would rather set it up to use the form. Since the option group will only reference numbers, I can't figure out how to make this correspond with my filter parameters. Any help would be appreciated.



How can I pass an Option Group parameter to execute a stored procedure? Basically I have 3 stored procedures and want the user to define which one of the three to execute by what option then select. I am looking for sample coding along the lines of:

if option 1 then
strSql = "exec pump "
if option 2 then
strSql = "exec dump "
if option 3 then
strSql = "exec marry "



I am designing a form which has an option group with 4 checkboxes. What I am looking for is that if there is any way by which whenever I click on "All Degree" check box it should check all the other check boxes (Engineering, Medicine, Business). Also I should be able to check any combination of those checkboxes. How can I do it? I am not an expert in Access but I do understand the basics of access.

I am attaching the file "test.mdb" in the test.zip file attached with this post . Please look at the form "Search" and all will make sense.

Your help will be greatly appreciated.


Ok, I'm trying to get a text box to only become enabled if a particular selection is made in an option group on the same form.
Here's the details...

OptionGroup = PaymentTypeOptions
Option1 = Cash
Option2 = Check
Option3 = Money Order

OptionGroup updates field "Payment Type" in table "Payments".

I have text box "Check#" that I only want enabled if option2 is selected.

I tried to do it this way but it doesn't do anything.

Private Sub PaymentTypeOptions_AfterUpdate()
If PaymentTypeOptions.Value = 2 Then
Check#.Enabled = True
Check#.Enabled = False
End If
End Sub

Not sure if this is the correct way of doing this.

Any help would be appreciated.

Thanks in advance,

I was hoping to create this on a form: have an option group with 2 options. When option 2 is chosen on the form, then a combo box automatically appears, and the user is forced to make a choice. And then have this choice reflected on the report. any advice would be greatly appreciated.

Hello Everyone,

I am having problems creating an option group on a form. Lets say, i will like to enter some measurements data in metric(millimeters) or Imperial(inches) on a form. If i select imperial, i want the form components to change to imperial measurements and vice versa. I dont know how to write VBA's, is it possible to accomplish this without writing any code.

I am working in Access 2007. And I am an extreme newbie to Access.

I have 3 tables:
ID FirstName LastName
ID ProgramName
ID UserID ProgID

My form consists of an unbound ComboBox whose Row Source is the User table. I added an Option group that displays the Programs. I want the default for this group to come from the combobox when the user selects their name.

I tried putting this in the Default Value:

	(SELECT DISTINCT ProgramUserXref .ProgramID FROM ProgramUserXref WHERE ((ProgramUserXref .UserID) = lUserID))

But that didn't work.

I also tried:

Private Sub cmbUser_AfterUpdate()
    lUserID = Me.cmbUser
    If Not IsNull(lUserID) Then
        Dim MySQL As String
        MySQL = "SELECT DISTINCT ProgramID FROM ProgramUserXref "
        MySQL = MySQL & "WHERE UserID = lUserID"
        Me!ProgID.DefaultValue = MySQL
     End If
End Sub

But that didn't work either.

Does anybody have any suggestions?


Access 2000 -

i have 7 check boxes inside an option group. four on top and 3 on the bottom...i want to control the order that the checkboxes are browsed through before one becomes selected.

right now this is the sequence it's taking: first one in the top row, first one in the bottom row, 2nd one in the br, 3rd one in the br, 2nd one in the tr, and so on...pretty screwy.

the order i want them to be "browsed-through" was the order i added them to the form...first row l to r and then bottom row l to r.

when i added this entry to the form...i used the option group wizard and selected the corresponding table entry.

there isn't a "tab order" feature for the check boxes within an option group that i can see...how do i chance the sequence of the check boxes when a user arrows through the option group?

also, is there a way for the check boxes to be browsed thru by the tab key instead of the -> <- arrow keys?



Hello -

I have an option group called ReportType set up on a form with two options that will determine the date range selected for a report.

In the OnClick event of the button to open the report I have the following:

If Me.ReportType.Value = 1 Then
DoCmd.OpenReport "rptCorrectiveAction", acViewPreview, , "OccurrenceDate > " & DateAdd("m", -12, Date)
DoCmd.OpenReport "rptCorrectiveAction", acViewPreview
End If

I do not receive any errors that my code is wrong but the report does not filter the dates.

Can someone please tell me what I am doing wrong?

I have a db with tbl_survey that has fields [Q1], [Q2] and [Q3] (for questions 1, 2 and 3). They are set as number fields. On my form frm_tbl_survey I have an option group for each question which assigns a value to [Q1], [Q2] and [Q3] depending on the option selected each question (I'm using option buttons without any default). The values are 1 (satisfied), 2 (neutral) and 3 (unsatisfied).

On the same table (and form)I have [Score].

I'd like the average of the values of [Q1], [Q2] and [Q3] to be displayed in [Score].

I built an expression in the default property of [Score] that reads [Q1]+[Q2]+[Q3]/3. But that didn't work. I kept getting zero as my return in [Score]. Then wrote code [Score]=[Q1]+[Q2]+[Q3]/3 in the on_enter event of [Score]. Now at least I get a number, but it's still a wrong return.

Any comments or suggestions on what I'm doing wrong and how I should correct it?
Thanks in advance.

Dear All

I have got an option group with three options. Each option is linked to a combo box. I mean combo boxes have been enabled with each option. So you select an option and then select values from combo box.

My question is that how is it possible that when an option is selected the other combo boxes become empty (No values remain selected even when is not enabled or faded)?

The reason is that I have given references of these combo boxes in a query criteria. If values remain selected in combo boxes, my understanding is that the query takes all those values as parameters and brings incorrect data.

I have struggling with it since this morning. Please help.

I have an Options Group on a form with two option radio buttons.

When an option radio button is filled, it updates the field with the option value instead of the text. Is there an way I can update the tabl with the Text instead the option value?