Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Making 2 option sets work as one (Access 2003 winxp sp2)

    I want to create option buttons for the entire alphabet but I can only have a maximum of 20, so I have 2 sets of 13, but they work independantly. Can I have it so that if I select a button from set 1, that all of set 2 will turn off and vise-versa?
    "Heading for the deep end"

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Making 2 option sets work as one (Access 2003 winxp sp2)

    Take a look at the attached sample which uses command buttons instead of an option group and see if that is of any help.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Making 2 option sets work as one (Access 2003

    Thankyou Charlotte,
    I was thinking along those lines while waiting for a reply. I want the button to filter a listbox with all the names starting with that letter from a bound table.
    I know I would have been stuck for a while on the call command as I would not have remembered to put the letter in quotes. I think I should use a function call like that to set an SQL source for the listbox and then requery the form to refresh the listbox. Am I on the right path?
    "Heading for the deep end"

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Making 2 option sets work as one (Access 2003

    Does this do what you want?

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Making 2 option sets work as one (Access 2003

    <P ID="edit" class=small>(Edited by MarkD on 28-Nov-05 22:20. Replaced attachment with revised demo file.)</P>Note - just because the socalled wizard only allows you to create 20 option buttons, it doesn't mean you cannot add additional buttons "manually" (drag from Toolbox on top of the option group frame). See att'd demo file for an example. It is similar to the other samples posted, only uses 27 option buttons (alphabet plus an "All" option) to filter list. Arrow keys can be used to navigate within option group. The query that populates listbox uses "Like" criteria as a "filter", referencing a textbox on form whose value is reset when option group is updated. In actual use you may want to hide the textbox from users - it's visible here for demo purposes. See demo file to see how it works. BTW, as noted in previous replies, command buttons are also a good (maybe better) way to do this.

    PS - Another option is to use Toggle buttons instead of Option buttons. Because toggle buttons have a "depressed" appearance may be best choice? See att'd (revised) demo file, added Option Group of toggle buttons (footer) ("synchronized" with the option buttons (header)).

    HTH

  6. #6
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Making 2 option sets work as one (Access 2003

    Thanks guys for all the input. Hans, I have basically gone with your idea, using 26 command buttons. I had actually got most of it set up so it was good to see that I was on the right track. I now have that part of the form working fine. An option button to choose male or female, alphabet cmd buttons to show first names starting with that letter. Depending on an a toggle button, double clicking a name will either register childID and date to another table (yet to be created) or open the Child form to edit details.

    Another thing I want to do is to populate the listbox with the names of all the reports in the database. I will have a command button that changes the list contents to all reports, with double clicking on a report name causing it to run. How can I do this?

    I have included my work in progress if anyone is interested in having a look and any corrections in method would be greatly appreciated.
    "Heading for the deep end"

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Making 2 option sets work as one (Access 2003

    I would use a different form, or at least a different list box, say lstReports, to list the reports. You can set its Row Source to

    SELECT Name FROM MSysObjects WHERE Type=-32764

    In the On Dbl Click event:

    Private Sub lstReports_DblClick(Cancel As Integer)
    DoCmd.OpenReport Me.lstReports, acViewPreview
    End Sub

    If you want to use the existing lstNames, you could use this instruction:

    Me.lstNames.RowSource = "SELECT Null, Name FROM MSysObjects WHERE Type=-32764"

    The Null is for the hidden first column of the list box.

  8. #8
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Making 2 option sets work as one (Access 2003

    After creating a listbox containing the names of all the available reports what code could be used in the after update event to print the selected report from the list.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  9. #9
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Making 2 option sets work as one (Access 2003

    I got it to work. When I tried the printing instruction you provided with the double click instruction initially, I must have done something wrong. I tried it again and everything works like it is supposed to.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Making 2 option sets work as one (Access 2003

    I wouldn't use the After Update event of the list box - if the user would use the keyboard to select a report by moving up or down the list, each report would be printed in turn. For a list box, the On Dbl Click event is more suitable, or the On Click event of a separate command button. See the code in my previous reply in this thread. To print directly instead of previewing, omit the <code>, acViewPreview</code> at the end of the instruction.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •