Results 1 to 5 of 5

Cascading combo boxes on bound controls

  1. #1
    Coasterman is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2019
    Posts
    8

    Cascading combo boxes on bound controls

    I have downloaded quite a few examples of this technique both but I'm still not getting it. Each time I think I have it right data disappears from the 2nd combobox or I am not getting any to select at all.



    I could ramble on here but rather than confuse I have put together a very simple example

    I would like to be able to save the users responses to each combobox not just the 2nd filtered combobox . It works for the first record but move to new record and things go awry

    I am sure this must be a fairly common requirement but I cant see what I am doing wrong?

    I would gratefully appreciate some guidance
    Attached Files Attached Files
    Last edited by Coasterman; 07-12-2019 at 04:21 PM.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,339
    I am not able to replicate what you're experiencing.

    Even on a new record when I choose a new main category I get the correct subcategory list.

    The only caveat I would say is that in your 'after update' event you also make the subcategory foreign key a null value, this'll prevent you from having a main category/subcategory that conflict.

    Finally when you go to a new record I would requery the subcategory combo box as well

    If you can give some specific instructions on where you are encountering your problem and how to replicate it that'd be helpful

  3. #3
    Coasterman is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2019
    Posts
    8
    Hi

    I am still as confused I'm afraid. I added the .requery of the subCatergory to the On Current event and it all now seems to be working. I can now go back to an earlier record or move forward and the selections from each combo are preserved and the tbl_CombineData is saving the user entry as I had hoped - thing is I don't know why?

    I can understand why it would be necessary to requery the after update event of the Main catergory combo but not why navigating between records would need to requery.

    In my simple logic if say record number 1 has user selections for each combo box (which are bound) I cannot fathom why if creating a new record and then going back to record number 1 the SubCat combox box would need requerying. I would have thought the values written to the tbl_CombinedData would have simply populated each combo as you moved through the records. Whilst I can see now that they do need requerying as you change record, as your advice has the problem fixed, I still don't know why? I'm keen to grasp the logic so if you wouldn't mind expanding I would be grateful.

    I was also a little lost around the null value and subCatergory FK?

    Thanks again

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    47,478
    Conditional comboboxes that have alias (value displayed is not value saved) require Requery because when filtered the RowSource does not have items in list associated with the record moved to. RowSource must be requeried so the list will apply filter for that record and the alias will be available in the list for display.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Coasterman is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2019
    Posts
    8
    Took a while but it's sunk in -thank you both, I also understand the why its necessary to Null the 2nd combo box as well now once I saw what was happening in the underlying table - makes perfect sense now.

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

Similar Threads

  1. Cascading Combo Boxes
    By cbramsey in forum Forms
    Replies: 3
    Last Post: 05-18-2017, 06:26 AM
  2. Cascading Combo boxes- bound; Cant select
    By AishlinnAnne in forum Forms
    Replies: 16
    Last Post: 08-15-2016, 02:48 PM
  3. Cascading Combo Boxes
    By JCW in forum Programming
    Replies: 4
    Last Post: 04-02-2014, 05:05 PM
  4. Cascading combo boxes
    By combine21 in forum Forms
    Replies: 3
    Last Post: 12-02-2010, 12:57 PM
  5. Replies: 10
    Last Post: 08-01-2009, 06:48 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
  •  
Tech Forums: Microsoft Office Forums