Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    Smile Access/VBA question regarding multiple selections in combo box


    Good morning all,


    I hope I'm in the right place. I have read more threads than I care to admit and cannot for the life of me figure this out. I have a multi-select combo box called MentalStatus, with selections such as Alzheimer's, Adjustment Disorder, Anxiety Disorder, Depression, etc. I have an invisible mufti-select combo box called AnxietyDisorderSpec that I want to make visible if Anxiety Disorder is chosen from MentalStatus. It works if ONLY Anxiety Disorder is chosen, but not if other items are chosen as well.


    I have tried Case statements, used column values, and a dozen other things with various results. Sometimes I get a "type mismatch" error, or "invalid use of null". I would post my code - but it is so messed up at this point it wouldn't be worth it.
    MentalStatus gets its values from another table, which can be changed by a user through a maintenance form. So Anxiety Disorder may not always be the 4th choice. So I've been trying to work with it as a text string, and a text string with wildcards.


    If anyone can point me in the right direction I would be so grateful.


    Thank you in advance.
    Gina

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You may have to help me here because I don't think there is such a control as a "Multi-Select ComboBox". A ListBox maybe but not a ComboBox. I could be wrong here.

  3. #3
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Yes, there is now. Thanks!

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    RiralGuy, he only place I have seen to make a milti-select combo box is a lookup field.

    There may be other places, however I have not found them.

    Dale

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks Dale. I'll do some research.

    @Gina: Are you using Lookup Fields? http://access.mvps.org/access/lookupfields.htm

  6. #6
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Table: ResidentMentalStatus
    Field1: ResidentID
    Field2: MentalStatus
    Data Type: Short Text
    Row Source Type: Table/Query
    Row Source: SELECT [MntMentalStatus].[MentalStatus] FROM MntMentalStatus;
    Bound Column: 1
    Allow Multiple Values: Yes

    On my form, the combo box lists all of the Mental Statuses with a check box next to each one. You can select one or many.

    I've seen many posts that people question the availability of multi-select comboboxes - but they are here, I assure you. Perhaps since V 2007.

    Thanks!

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Not ever having used Lookup Fields I will have to plead ignorance. ComboBoxes on forms are just fine but Lookup Fields tend to just confuse the developer.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    @Gina: What code is in the AfterUpdate event of your ComboBox?

  9. #9
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Quote Originally Posted by Gina Maylone View Post
    Good morning all,


    I hope I'm in the right place. I have read more threads than I care to admit and cannot for the life of me figure this out. I have a multi-select combo box called MentalStatus, with selections such as Alzheimer's, Adjustment Disorder, Anxiety Disorder, Depression, etc. I have an invisible mufti-select combo box called AnxietyDisorderSpec that I want to make visible if Anxiety Disorder is chosen from MentalStatus. It works if ONLY Anxiety Disorder is chosen, but not if other items are chosen as well.


    I have tried Case statements, used column values, and a dozen other things with various results. Sometimes I get a "type mismatch" error, or "invalid use of null". I would post my code - but it is so messed up at this point it wouldn't be worth it.
    MentalStatus gets its values from another table, which can be changed by a user through a maintenance form. So Anxiety Disorder may not always be the 4th choice. So I've been trying to work with it as a text string, and a text string with wildcards.


    If anyone can point me in the right direction I would be so grateful.


    Thank you in advance.
    Gina
    I hope I'm replying correctly. I am embarrassed to even post this, but this is what I have now which I am getting the error "Type Mismatch"

    Select Case True
    Case Me.MentalStatus Like "*AnxietyDisorder*"
    Me.AnxietyDisorderSpec.Visible = True
    Case Else
    Me.AnxietyDisorderSpec.Visible = False
    End Select

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Any chance you could provide a sample db that demonstrates the issue while not including private data?

  11. #11
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847

  12. #12
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Quote Originally Posted by RuralGuy View Post
    Any chance you could provide a sample db that demonstrates the issue while not including private data?
    MentalStatus.zip Again, I hope I did this correctly. You will see my Event Procedure is a mess. Thanks so much!!

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Boy are these things weird to work with. Try this db.
    Attached Files Attached Files

  14. #14
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    OMG!!! THANK YOU!!! THANK YOU!!! THANK YOU!!! IT'S PERFECT!! YOU'RE BRILLIANT!!!

    And yes, they are weird to work with. I just found out I can't move the data from one table to another. Unfortunately, it's the only way I can figure out how to allow the user the ability to maintain the source table and have multiple selections.

    Again - thank you from the bottom of my heart!! I hope you have a fantastic afternoon!!

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm still not a fan of these Multi-Select ComboBoxes. AFAIK they are not supported by SQL server and are avoided by most developers. I marked this thread as Solved for you.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-21-2013, 12:57 AM
  2. Replies: 5
    Last Post: 01-15-2013, 01:27 PM
  3. Replies: 2
    Last Post: 05-27-2011, 08:12 AM
  4. Simple Combo Box Multiple Select Question
    By ahamilton in forum Access
    Replies: 7
    Last Post: 03-17-2011, 01:38 PM
  5. Replies: 1
    Last Post: 03-02-2009, 11:54 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums