How do I evaluate if all or some of items in list box are selected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wade
    New Member
    • Sep 2006
    • 7

    How do I evaluate if all or some of items in list box are selected

    I have form with a listbox "lstOperator(s) " which is populated by "tblOperators.O peratorName". At the top of the list I have added the option to "Select All". I have added a command button "cmdNext" to the form. If "Select All" is selected in "lstOperato rs", I want to preview a report "rptProduct ion" with no filtering when "Next" is clicked. If only some of "lstOperato rs" listings are selected, I want to go to another listbox "lstLeases" when "Next" is clicked. How do I code this please?
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by Wade
    I have form with a listbox "lstOperator(s) " which is populated by "tblOperators.O peratorName". At the top of the list I have added the option to "Select All". I have added a command button "cmdNext" to the form. If "Select All" is selected in "lstOperato rs", I want to preview a report "rptProduct ion" with no filtering when "Next" is clicked. If only some of "lstOperato rs" listings are selected, I want to go to another listbox "lstLeases" when "Next" is clicked. How do I code this please?
    If I,ve read the description of your requirement properly your listbox contains the physical words "Select All" as part of the data under which then comes then a list of operators.

    Personally I'd loop the listbox and select all of the operators in code by hitting a button and 'actually' selecting all of them in the list and base the logical action on that. It is the usual method or typical way one selects items in a listbox but I won't dwell on that in favour of your posted descriptive requirement

    I've created a very simple attached zipped database of what I think you are meaning. Its not particularly efficient code but have done for clarity of understanding the logic involved given you are a relative newcomer to code you might expect that.

    Regards

    Jim :)
    Attached Files

    Comment

    Working...