Results 1 to 4 of 4
  1. #1
    CRobledo is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    26

    Requery Combo box with multiple select enabled

    I have a cascading combo box with the option to select multiple items named (cmbBlock) it displays options depending on the combo box selection above it named (cmbVeriety). I would like it to requery every time cmbVariety changes. Below is the code I'm using.

    Private Sub cmbVariety_AfterUpdate()
    Me.CmbBlock = vbNullString


    Me.CmbBlock.Requery
    End Sub

    But it seems that because the multiple value select with checkboxes is enabled it wont properly equerry. It displays the new options but also retains any check from the previous selection.

    I have this in the afterupdate of cmbVariety. I'm not very good with VBA what do I have to add for the previous selected options to be unchecked.

    Click image for larger version. 

Name:	1.PNG 
Views:	22 
Size:	9.0 KB 
ID:	27507

  2. #2
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    I suggest you sanity check by making a stand alone query - that calls in the cmbVariety value as criteria. Select a Variety and then run that query to see that it returns the correct record set. This should give you insight to your design issue.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    I think it is because you appear to be using a multivalue field - it actually stores the selections in a hidden table, so you will need some sort of code to delete all the records. I avoid using them because of their limitations so cannot suggest what that code would be but suspect somewhere down the line you will need to refer to the .value property of the field.

    As NTC suggests, create a query and see what it looks like - if you have two selections (e.g. 24,26) you will get two rows of the table

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Ajax View Post
    I think it is because you appear to be using a multivalue field
    I'm sure that's it; MultiSelect is only a Property of Listboxes...not Comboboxes. The only Comboboxes with this type of capability are those displaying a Checkbox for each selection, as you mentioned...which means that the Field is a MultiValue Field, and they demand all kinds of special handling, not seen in other Datatypes...which is why most experienced developers eschew their use.

    arnelgp gives some explanation/advice on this in this post:

    https://access-programmers.co.uk/for...d.php?t=286000

    Perhaps it will help.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 1
    Last Post: 09-11-2014, 05:53 AM
  2. Multiple Select Combo Box
    By empyrean90 in forum Forms
    Replies: 4
    Last Post: 11-14-2012, 07:32 AM
  3. Replies: 4
    Last Post: 09-17-2012, 10:36 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: 47
    Last Post: 06-17-2010, 03:04 PM

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