Help with option group code

MS Office Access

    Next

  • 1. incrementing values based on records
    I have a form based on a table which has an Order ID number. Every time I make a new record I want the value to just increase by 1 (based on the last record in the table). How do I do this?
  • 2. How to requery updated data in form?
    Hi, Newbie me again. Now that I have sorted out my combo box problem on my Orders form, I would like to have my combo box updated with new data immediately after I add a new customer. At the moment I have a refresh button on the form. I also add a new customer from a command button (Add Customer which opens the Customers Form in data entry mode.) My combo box control source is Orders.CustomerID and its rowsource is qryCustomerNames. I assume I have to put the requery on an event (exit?) on the Customers form. But what is the code I use. Thanks heaps for any help.
  • 3. Conditional Expression, Change To Red is >30
    The field name on form is named Days Past Due as is the Control Source name. It counts how many days past due the Invoice is. If it is over 30, I want it to change to Red. Here is the code I tried, didnt work. Expression is [Days Past Due]>30
  • 4. I am trying to get a form to pick up the record data from a different record to this new record
    I have a sub with two records Service date and next service date I would like to be able to fill in service date from the previous record next service date Can it be done.
  • 5. Form always defaults to centre on open
    I have a main form that contains a tab control in the detail section. Each of the tabs (approx. seven) contain their own sub-form. Each of the sub-forms vary in size (height). The problem I have is that when the user clicks on any of the tabs, it always opens the sub form looking at the centre of it. I have set all the 'align centre' to "No", but it doesn't seem to make any difference. What do I have to do so that when the user clicks on any of the tabs, it will always open the sub-form looking at the top of it???

Help with option group code

Postby Rm9sbGFuQQ » Tue, 19 Jul 2005 08:56:02 GMT

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.

Cheers,
Andrew

Re: Help with option group code

Postby John Vinson » Tue, 19 Jul 2005 10:23:54 GMT

On Sun, 17 Jul 2005 16:56:02 -0700, "FollanA"





The code would be in the AfterUpdate event of the option group
control. You'ld use the OpenForm event to open a second form with a
textbox and a command button on it. The query would have a criterion

=[Forms]![nameofform]![nameofcontrol]

on the user input field; typically you'ld base a Form on this query to
display the results, rather than opening a query datasheet.

Your question doesn't clearly indicate what role the value selected in
the option group plays; is its value used as the search criterion, to
control the message, or what?

                  John W. Vinson[MVP]    

Similar Threads:

1.Need Help With Option Group Code

I'm sure this is very easy, but I have no idea how to go about it:

I've created a flexible search page.  On this page, the user can
search for records using all of the criteria or only one criteria.
Everything works fine except for the criteria selection from an option
group.  The name of this option group is OptionGroup (how creative is
that?), and the three radio buttons given the user three different
possibilities:  Option 1-Choose records that are labled as "open".
Option 2- Choose records labled as "closed".  Option 3-  Choose
overdue records by selecting those records whose tickledates are
previous to today.  Here's the code that I wrote up.  I know something
is wrong with it since it's not working, so any information would be
greatly appreciated.

  'Search by radio button selection, and gets exact match of field.
If no radio button is selected, than loops onto the next criteria

If Not IsNull(Me.OptionGroup) Then
          Select Case Me.OptionGroup
               Case 1
                    strWhere = strWhere & " ([Status] = Open) AND "
               Case 2
                    strWhere = strWhere & " ([Status] = Closed) AND "
               Case 3
                    strWhere = strWhere & " ([Status] = Open AND
([TickleDate] < Now())) "


End Select
End If

2.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!!

Emma

3.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 -

4.Request Option Group Code Fix & Addition

Hello!

I'm using the following option group code to filter reports by
age......month, quarter, and year. I am looking to do two things here.
First I'm looking for a fix for the "quarterly" code...It is not
working properly and needs to be adjusted. 

Secondly I am looking to add options here...primarily the following,

"Last 14 Days"  
"Last 30 Days"
"Last 90 Days"
"Last 180 Days"
"Last 365 Days"

What would the appropriate Code be for this? Here is the case code I'm
presently using and want to add options to...


Private Sub Command11_Click()
On Error GoTo Err_Command11_Click

    Dim stDocName As String
Dim stWhere As String

    stDocName = "CLI_DetailedAttendance_Rep"
  Select Case [Frame0]

Case 1 'Current month
        stWhere = "Month([Date]) = " & Month(Date) & "And Year([Date])
= " & Year(Date)

Case 2 'Current quarter
        stWhere = "DatePart("q", [Date]) = " & DatePart("q", Date)& "
And Year([Date]) = "& Year(Date)
               
Case 3 'Current year
        stWhere = "Year([Date]) = " & Year(Date)
        
End Select
   DoCmd.OpenReport stDocName, acPreview, , stWhere



Many Thanks!

Kevin

5.Option Group Value won't display in Query when code is executed

Hello,

I have an option group stored on a form with 4 choices and am just trying to
usethe value selected in the option group within a query.  Simple enough, I
can get the query to work just fine, displaying information based on the
choice made with the option until I execute the query from code.  Then it
seems that the option group value is not available or is ignored and does not
work.  What I'm noticing is that if I pause the code at the point where the
query is suppose to run and execute the query manually, no information is
displayed (option group value shows blank).  However, if I stop the code
completely at that point and then run the query, the information is displayed
just fine.

Can anybody tell me what is going on here?  I'm stumped.

Regards,
Ryan

6. option group code

7. Option group coding

8. Visual Basic Code for option groups and Combo box



Return to MS Office Access

 

Who is online

Users browsing this forum: No registered users and 73 guest