Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2011
    Posts
    71

    Unanswered: Multi-Select Combo Box

    I am in a small quandry over how to handle this information in my database. I am currently using Access 2010. I am wanting to collect an incident type. There are 4 values an incident can have. It can have all of them or just 1. I wanted to use a multi-select combo box to select this informaiton. However, The only way to do this in access is to have a field with multipule values and that just sounds like a problem waiting to happen.

    The other option that I see is creating two other tables.
    Incident-----< IncidentType>------Type

    However, my brain has turned off at that point and I'm not sure how to proceed. I'm assuming I'd need to put a subform into my data entry form but I'm not sure how I'd go about doing that.


    I know this is a basic question and I'm pounding my head on the keyboard because I can't get passed. Thanks for taking the time to read and respond!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by ericx1 View Post
    I wanted to use a multi-select combo box to select this informaiton.
    There is no such thing as a multi-select ComboBox in Access.

    The MultiSelect property is only available for a ListBox control.

    If the different values are on the same line of a multi-colum ComboBox, you can retrieve the values of the different columns using this syntax:
    Code:
    Me.Combo1.Column(x)
    Where x is a numeric index. The first (leftmost) column of a ComboBox being Column(0), the second being Column(1), etc.
    Have a nice day!

  3. #3
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297
    I'm assuming the incidents are all strings?

    If so, I'd have a multi-select LISTBOX, that gets populated with the 4 different types of incidents.

    Then the user can select whichever of the 4 incidents apply.

    As for the table, I would suggest you simply have 4 fields; [Incident 1], [Incident 2], [Incident 3], [Incident 4], all set to a type of 'Yes/No' (boolean), and simply convert a selected incident in the listbox to a True or False in the appropriate field.

    There are more complex, and some would say neater solutions to this, but I don't see why you should have a problem doing as I've suggested. More complex solutions would normally be used if you had more than 4 possible outcomes, say 15 or so, where it obviously wouldn't be practical to have 15 yes/no fields on a table.


    Alternatively, if they're just numbers (as in codes, like; 1, 2, 3, 4), I would probably keep one field on the table, and assign them more complex codes. Something like:
    Code:
    1 = 1
    2 = 4
    3 = 8
    4 = 11
    Then simply sum them, so if incident code 1, 3 and 4 were all used... Using the new coding system, you'd do: 1 + 8 + 11 = 20. You'd then save 20 to the [Incident] field on your table. Using those numbers, there's no way to get the same result from any other combination. i.e. Every combination of those numbers, results in a unique number. So you would know that code 20, would refer to incident 1, 3 and 4 taking place... If you follow me..?


    Let me know if that makes sense and sheds some light for you (if I've understood your requirements properly anyway).
    Last edited by kez1304; 11-17-11 at 12:43.
    Looking for the perfect beer...

  4. #4
    Join Date
    Oct 2011
    Posts
    71
    Thank you all for your reply. After I finally got some caffinee in my system this morning I started thinking again. I realized as was stated in the first reply, that I couldn't use combo, only list. However, with list the user would have to hold down Ctrl, to select the item, sometimes I don't have faith in the user.

    So I decided to just keep the fields on my primary table, make them Yes/No and make an area with 4 check boxes. It doesn't look as neat as I would like it too, but its simple and gets the job done.

    Thanks for your time, I appreciate it.

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    As I was reading down this thread I was going to suggest the solution that you came on yourself! Like kez1304 said, it would be a different matter altogether if you were talking about 10 or 15 options, but with only four options four Checkboxes really makes the most sense.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Quote Originally Posted by Sinndho View Post
    There is no such thing as a multi-select ComboBox in Access.

    The MultiSelect property is only available for a ListBox control.
    That isn't entirely accurate. The new (with 2007 I think) multivalue fields can be represented by a combo with checkboxes to select the item(s). I wouldn't use a multivalue field myself, but it will present you with what is basically a multiselect combo.
    Paul

  7. #7
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297
    Quote Originally Posted by ericx1 View Post
    However, with list the user would have to hold down Ctrl, to select the item, sometimes I don't have faith in the user.
    This is only true if you select 'Extended' for the multi-select option on the listbox.

    Selecting 'Simple', is what you're after...
    Left-click on an item to highlight it
    Left-click it again to un-highlight it.

    Exactly the same as how the checkboxes work, but all in one convenient place, no CTRL or SHIFT required.
    Looking for the perfect beer...

  8. #8
    Join Date
    Oct 2011
    Posts
    71
    Ah, did not know that one. Thanks that is actually very handy little tip. Helps if i go through and look at the properties of each control. Thanks again!

Posting Permissions

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