Results 1 to 6 of 6
  1. #1
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46

    Message Box and Multi Select Combo Box Limiting Users Selections

    Hello,

    If someone could help. I have a multi select combo box that list employee names. The users can select up to 3 individuals if more than 3 a message box appears
    "You have selected more than 3 individuals."

    What I would like to have happen is the users MUST make corrections to the comb box if they have selected more than 3 before they can continue to the
    next question.

    This is the code that I have written so far. I am pretty new to this

    [Private Sub go_to_person_Project_AfterUpdate()
    If go_to_person_Project.ItemsSelected.Count > 3 Then
    MsgBox "You have selected more than 3 individuals."
    End If]



    Any help is greatly appreciated!

    Thanks in advance

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I assume you mean you want the code to stop at that point. One way would be to add

    Exit Sub

    after the message box.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    The code does stop at that point, but what I am hoping for is to make the users correct the number of individuals they have select. An error that freezes the combo box so they must correct their answers.
    Right now they can click ok and the combo box will still accept more than 3.

    Thank for replying.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I do validation in the before update event of the form or control, as appropriate:

    http://www.baldyweb.com/BeforeUpdate.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Holli is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    46
    Great!
    Thanks Paul

    Holli

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem Holli, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 05-15-2013, 03:36 PM
  2. Replies: 2
    Last Post: 08-31-2012, 02:20 PM
  3. Turn a list into a Multi select combo box
    By seth1685 in forum Programming
    Replies: 1
    Last Post: 01-11-2012, 07:52 AM
  4. Multi Select Combo box for print function
    By jparker1954 in forum Reports
    Replies: 11
    Last Post: 09-17-2011, 03:08 PM
  5. Limiting access to certain users only
    By huskies in forum Security
    Replies: 1
    Last Post: 04-01-2009, 08:18 AM

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