Options Group Coding Question

MS Office Access


  • 1. Getting count of records in Access97 vba
    I have tried many different tools to get a count of a subset of records in a table. These include DCount, DLookup, and RecordCount of a recordset. All have failed me due to the same problem. I can't get a date comparison to work. However, I am able to accurately get a count of records using a DoCmd.OpenQuery statement with a query that somehow can handle the date comparison correctly. I tried posting a question on help for why the date comparison isn't working, but no one answered. So my question here is: is there any way to return the count total from a DoCmd.OpenQuery statement that comes up with a value in a CountOfFieldName field? Thanks for any help or suggestions you may have.
  • 2. Testing for a internet connection
    RAS = "Remote Access Services". It's the way your computer detects Internet connections and does the dialing out (and hanging up) for specific internet connections. If you have more then one connection method, it's also the way you select which service (AOL, MSDN, etc.) to use. Do a search for "RasApi32.DLL" and you'll see what all can be done with it, and (no doubt) quite a bit of code on how to use it! On Tue, 24 Jun 2003 02:09:47 GMT, "Tom" < XXXX@XXXXX.COM > wrote: >Thank you for responding!! >What is RAS? >"Chuck Grimsby" < XXXX@XXXXX.COM > wrote in message >news: XXXX@XXXXX.COM ... >> Not via DAO (which is for databases), but certainly via RAS. >> Search at Google for the (previously posted) code, and remember that >> the code changes depending upon what operating system is in use. >> On Mon, 23 Jun 2003 20:22:50 GMT, "Tom" < XXXX@XXXXX.COM > wrote: >> >Is there a way to programatically (DAO) test for an internet connection and >> >if not connected to envoke Dial-Up Connection? -- :-) Life Is Just One Big Smile (-:

Options Group Coding Question

Postby Dave » Fri, 06 Aug 2004 13:50:46 GMT

I'm using Access 2000 & I have a form that has both a drop down box with two
specific choices and later an options group with three selections.

What I want is if I selection the first selection from the drop down box to
ghost out the third item in the option box.  Is this possible?

Any help would be appreciated.

Re: Options Group Coding Question

Postby Wayne Morgan » Fri, 06 Aug 2004 20:27:08 GMT

Yes, it is. In the AfterUpdate event of the combo box and possible the 
Current Event of the form, you would check the value of the combo box and 
disable or enable the option control.

Me.optOptionButton.Enabled = Not (Me.cboCombobox = "My Value")

The part in the parenthesis will return True or False, the Not will reverse 
this value and apply it to the Enabled property of the option button or 
check box that you are using in the Option Group. Remember that the Value of 
the combo box is the value in the bound column, which may not be the visible 
column. Also, if the value is a number instead of text, remove the quotes.

Wayne Morgan
Microsoft Access MVP

Re: Options Group Coding Question

Postby BrainlordMesomorph » Fri, 06 Aug 2004 20:37:15 GMT

AfterUpdate event on the combobox, 

if me.mycombobox = "whatever the 1st one is" then_
me.OptionGroupThirdChoice.enabled = false


On Thu, 05 Aug 2004 04:50:46 GMT, "Dave" < XXXX@XXXXX.COM >

Re: Options Group Coding Question

Postby Dave » Fri, 13 Aug 2004 10:03:58 GMT

Thanks for the help!  That worked perfectly!!!

I have one more question related to this.  How can I now get the combo box
to be disabled with that option is selected from the Option Group?  Since I
am now able to prevent them from selecting the wrong option item I want to
make sure that they cannot manipulate the situation by going back & changing
the combo box after the fact.

Again, I really appreciate the help!


Re: Options Group Coding Question

Postby Wayne Morgan » Sat, 14 Aug 2004 03:41:45 GMT


You're going to need to word this one a little better. I don't know which
option in the option box you want to select in order to disable the combo

Wayne Morgan
MS Access MVP



Re: Options Group Coding Question

Postby Dave » Tue, 17 Aug 2004 02:20:32 GMT

Let me see if I can explain this better.

I'll create this example.

In the Combo Box I have two options.  Basketball; Football

In the Options Group I have three items.  Scoring; Teams; Touchdowns

The formula that you provided me allowed me to disable or ghost out
"Touchdowns" when I select "Basketball" however I have found that I can
originally select "Football" and then go down & select "Touchdowns" and then
go back & change the first box back to "Basketball" and then the report will
list a basketball game with touchdowns which obviously makes no sense.

One last note, I have the form setup so that "Basketball" is the default
option because it's the used frequently and I'd like to keep it so that the
user can go back & update that option if they need to.  I would just like to
make it so that if "Touchdowns" is selected that "Basketball" becomes an
invalid selection in the Combo Box.

Thanks again for your help!


Re: Options Group Coding Question

Postby Wayne Morgan » Tue, 17 Aug 2004 13:37:46 GMT

Ok, I can follow what you're doing now. There are a couple of ways to do 
this. The first one would be as you mentioned, block choosing Basketball if 
Touchdowns is selected. The other would be to undo the Touchdowns selection 
if Basketball is chosen.

1) In the combo box's BeforeUpdate event check the value of the option 
group. If Touchdowns is selected, pop-up a message box warning the user of 
the problem, set Cancel = True, and Me.cboMyCombo.Undo.

2) In the combo box's BeforeUpdate event check the value of the option 
group. If Touchdowns is selected, pop-up a message box waring the user of 
the problem and set the option group = Null or one of the other two values.

Wayne Morgan
MS Access MVP

Similar Threads:

1.making option groups visible/invisible based on another option group selection

I have a form on which there are 3 option groups.  my 
first option group determines which of two other options 
groups will be visible to to user.  I have placed the 
following code in the afterupdate event of the first 
option group.  I know it's wrong.  Can someone help me out 
with the correct code?

Private Sub Request_Type_Frame_AfterUpdate()
'Hide or Unhide Purpose Frame
'Request Type either 1 or 2
 Select Case Request_Type_Frame(Request_Type)
'If Request_Type is 1 Show only Sponsorship frame and hide 
Consulting frame
    Case 1 Sponsorship_Purpose_Frame.Visible 

'...I'm not sure how to make the Consulting_Purpose_Frame 
invisible here
             Consulting_Purpose_Frame.Visible = False

'If Request_Type is 2 show only Consulting Frame and hide 
sponsorship frame
    Case 2 Consulting_Purpose_Frame.Visible = true

'...same here for the Sponsorship_Purpose_Frame here
             Sponsorship_Purpose_Frame.Visible = False

 End Select
End Sub

Your help is much appreciated!!


2.Option Group within another Option Group?

I want my form to have two "nested" option groups.  The first option is  
"Existing Employee" and the second option is "New Position".  If the first 
option is selected, I want additional information to appear that allows the 
user to put in a desk location number.  If the second option is selected, I 
want the user to be able to select the date that the new position has been 
budged for (i.e., 2005, 2006, 2007, etc.)

It would be nice if the detail information below each option (desk number, 
or date position is budgeted for) doesn't appear unless their relevant 
"first" option has been selected.   Does that make sense?  

I tried an option box with the two options "Existing Employee" and "New 
Position", but when I added the dates under "New Position", I didn't know how 
to link that to ony the "New Position" Option.

Any help is greatly appreciated!

K -

3.Question with Option Groups and Check Boxes

Hello, I have a question regarding the use of combo boxes on a data entry form.

I was wondering, is it possible to cause the option group or check box to 
return to the default value after entering the current record (aside from 
making the end user click a seperate 'refresh button' after every entry along 
with the standard 'next record button).

Currently, the form keeps the value selected, which means that in the case 
where it does not need to be selected, it must be unselected.

Thanks in advance for your help in resolving this issue.

4.Unbound option group question

I have a option group which is unbound as i use it to enter text via:

Private Sub optward_AfterUpdate()
    On Error Resume Next
    Me.[ward] = Choose([optward], "First Text", "Second Text", "Third Text", 
"forth text", "fifth text", "sixth text") please ignore text wrap

end sub

however since adding this code, when i use a command button to move onto the 
next new record the toggle buttons do not reset, and the selection remains. 
how do I reset the option group to be as a new entry?
Your help is appreciated as always, 

steve adlam

5.Help with option group code

Hi All,

I have an option group (called options) with 4 values in it. I also have a 
command button on the page.

What I need to happen is once the user has selected an option and clicked 
the command button another window pops up with an input field which the user 
than needs to fill out and press ok which will then run a query which is 
filtered by the users input. Make sense? :)

Hope someone can help with the code, just a snippet of what is required 
would be great.


6. Option Group - Question

7. Access Option group question

8. Option Group Value Question

Return to MS Office Access


Who is online

Users browsing this forum: No registered users and 96 guest