Results 1 to 6 of 6
  1. #1
    ccook241 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    6

    Cascading combo requery issues

    Hello all,



    I have cascading combo boxes nested within subforms. I've managed to set the row source of the subform combo boxes such that they refer to the parent form combo box, but I am having trouble getting the requery in the After Update event of the first combo box to work.

    I've tried using the Code Builder in the After Event field of the first combo box with derivations of lines such as these:

    Parent Form = frmSite
    Subform = subfrmLightDate
    1st combo = cboSite
    2nd combo = cboDate

    cboDate.Requery
    Me.cboDate.Requery
    Me.subfrmLightDate.form.cboDate.Requery
    Me.Parent![subfrmLightDate]![cboDate].Requery

    and so on without any luck. The main error is "Method or data member not found" with cboDate highlighted. I don't understand why the parent form is not recognizing code related to subforms. The Link Child and Link Master Fields are both properly set up.

    I'm working in Access 2016 and it automatically builds Embedded Macros in the After Update event of the first combo. When I use the code builder it erases those macros. I'm wondering if this is part of the problem?

    Any advice is greatly appreciated!

  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,518
    I would expect this to work, presuming the code is in the main form and the subform has the combo:

    Me.subfrmLightDate.form.cboDate.Requery

    I would expect form to capitalize itself. Make sure
    subfrmLightDate is the name of the subform control rather than the subform itself, if they're different.

    To your second question, you can either have a macro in the event property or Event Procedure pointing to VBA, not both.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ccook241 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    6
    As I type the code it auto fills/recognizes everything up to cboDate. I'm not sure why it won't recognize the cboDate combo box.

    The line of code you gave me doesn't return the error message anymore but the cascading combo boxes no longer retrieve values. I have a feeling this is likely because the code builder clears the embedded macro (see image).
    Attached Thumbnails Attached Thumbnails cbo.JPG  

  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,518
    Like I said, you can have a macro or VBA, not both (though one could theoretically call the other). Why not just the requery to that macro?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ccook241 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    6
    Quote Originally Posted by pbaldy View Post
    Like I said, you can have a macro or VBA, not both (though one could theoretically call the other). Why not just the requery to that macro?
    I'm having difficulty using the macro builder... I select Requery and it asks for the Control Name and I haven't yet figured out what that's referring to.

    I guess I could change my approach and focus on learning this feature.

  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,518
    The control name is the name of the combo you want to requery. I don't use macros, but presumably you'd use the builder to get the appropriate path.
    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: 0
    Last Post: 07-05-2016, 09:29 AM
  2. Cascading Combo Box and Subform Issues
    By RossIV in forum Forms
    Replies: 13
    Last Post: 07-18-2013, 09:16 AM
  3. Requery with cascading combo boxes
    By TanyaH in forum Forms
    Replies: 8
    Last Post: 04-21-2013, 07:12 AM
  4. cascading combo boxes, .requery not working
    By jsmath22 in forum Forms
    Replies: 8
    Last Post: 10-12-2012, 12:28 PM
  5. Cascading Combo Boxes Requery Problem
    By Jo22 in forum Forms
    Replies: 9
    Last Post: 01-28-2012, 09:41 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