Results 1 to 9 of 9
  1. #1
    TanyaH is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3

    Requery with cascading combo boxes

    Database1.zip

    Hello everyone,

    I have been struggling to make a cascading combo box that will successfully requery. When I select a value in the first combo box, my cascaded combo box shows the appropriate values. However, if I change the value in the first combo box, the second, cascaded combo box does not update its values. I have attached a very basic database in case you would like to take a look. I hope it is something simple that I am overlooking.



    Thank you in advance for any help you can offer!

  2. #2
    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 TanyaH View Post
    ...if I change the value in the first combo box, the second, cascaded combo box does not update its values...
    It updates for me, which is to say the selections in the dropdown for the second Combobox are appropriate for the selection that was last made in the first Combobox.

    Now the selection made from the second Combobox is still showing in that Control, after a new selection is made in the first Combobox; is that what you mean by 'does not update?' If this is what you mean, change

    Code:
    Private Sub ProjectCombo_AfterUpdate()
     SubCombo.Requery
    End Sub

    to

    Code:
    Private Sub ProjectCombo_AfterUpdate()
     SubCombo.Requery
     Me.SubCombo = Null
    End Sub

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

    All posts/responses based on Access 2003/2007

  3. #3
    TanyaH is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3
    Hi Ling,

    I really appreciate your quick reply and your clear explanation of how to update the code. Unfortunately, when I made that change, the values in the second combo box still do not update when the first combo box is changed. When I pick "Kisumu" in the first (project) combobox, the subprojects for Kisumu show appropriately in the second (subproject) combo box. However, when I change the first (project) combo box to "Meru," I would expect to see only one value available in the second (subproject) combo box, CHI, but the subprojects belonging to Kisumu still display. Can you think of anything else I might be missing?

    Again, I am very grateful for your help!

    TanyaClick image for larger version. 

Name:	Project1.png 
Views:	13 
Size:	5.1 KB 
ID:	11514Click image for larger version. 

Name:	Project2.png 
Views:	13 
Size:	5.8 KB 
ID:	11515

  4. #4
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    what u have seems to work fine.

    some of these quirky things are because of software problem. i can't remember what problem i was having, i think it was either requery or filter, i searched on the net and found i needed to get service pack 2 for my version of access.

    make sure u have all the updates installed.

  5. #5
    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
    The Comboboxes work exactly as they should, for both qa12dx and myself, in the file you attached. In re-reading your original post, though, I see that you said
    I have attached a very basic database
    Does this means that it is not the actual file that you're having trouble with? If so, what happens when you use the Comboboxes on this file? Does it cascade properly or does it exhibit the same behavior as your original file?

    Both qa12dx and myself are running Access 2007, so I suppose this could be a 2010-specific problem, but it's not one that I've seen reported on the half a dozen Access forums that I monitor daily.

    Both of the Comboboxes are Unbound on the file you attached; is that the situation on the actual file you're having trouble with?

    Although we usually think of Forms or entire Databases when we speak of corruption, individual Controls, such as Comboboxes, can and do become corrupted. The test and the fix are one and the same; deleting the Control then re-creating it! If it was corrupt, you've verified the fact and solved the problem! If the Comboboxes on the 'basic file' you attached work for you, need to delete and re-create the second Combobox on your original file.

    The advice qa12dx gave, vis-à-vis having all updates in place, is something to consider, if all else fails. Personally, I've always been leery of applying new service packs

    • Until they've been available for a while or
    • I'm having problems that are documented to be resolved by a service pack

    Note that I said 'personally.' Some people update every time a new SP or hotfix comes out, but all too often the fixes for one problem end up introducing other problems, so I usually give them a while to prove themselves.

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

    All posts/responses based on Access 2003/2007

  6. #6
    TanyaH is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    3
    Hello,

    Thank you both for your suggestions and taking the time to test the database. The database attached is not the same one I orginally had the problem with, but I am having the same issue with the attached one, and I wanted to isolate the problem as much as possible and didn't want to put too much information from my organization on the internet.

    After learning that this was working for both of you, I continued to scour the internet for solutions. This is really embarrasing to admit, but hopefully will help someone in the future if they ever have the same problem...I had not enabled all content in the database and am enough of a VBA novice not to know that this would prevent the code from working. Like I said, it's embarassing.

    Again, thank you so much for your replies and time. What a great resource full of kind people!

  7. #7
    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
    Glad you figured it out!

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

    All posts/responses based on Access 2003/2007

  8. #8
    moona is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2013
    Location
    Mississauga, Ontario, Canada
    Posts
    14
    Hi Tanya,

    What did you enable to get this working?
    I am having the same issue and using Access 2007.

    What is enabled "all content in the database"?

    Thanks

  9. #9
    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
    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. Cascading combo boxes
    By Jackie in forum Access
    Replies: 5
    Last Post: 07-26-2013, 09:07 AM
  2. Cascading Combo boxes
    By finsmith in forum Forms
    Replies: 10
    Last Post: 02-12-2013, 09:37 AM
  3. cascading combo boxes, .requery not working
    By jsmath22 in forum Forms
    Replies: 8
    Last Post: 10-12-2012, 12:28 PM
  4. Cascading Combo Boxes Requery Problem
    By Jo22 in forum Forms
    Replies: 9
    Last Post: 01-28-2012, 09:41 AM
  5. Help with Combo Boxes/requery....etc
    By noaccessguru in forum Forms
    Replies: 9
    Last Post: 06-06-2011, 05:50 PM

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