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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Making 2 option sets work as one (Access 2003 winxp sp2)

    Author
    Topic
    #426784

    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?

    Viewing 1 reply thread
    Author
    Replies
    • #987172

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

      • #987175

        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?

    • #987339

      (Edited by MarkD on 28-Nov-05 22:20. Replaced attachment with revised demo file.)

      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

      • #987423

        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.

        • #987429

          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.

          • #987457

            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.

            • #987461

              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 , acViewPreview at the end of the instruction.

            • #987471

              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.

    Viewing 1 reply thread
    Reply To: Making 2 option sets work as one (Access 2003 winxp sp2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: