none
Can't Requery Subform RRS feed

  • Question

  • I have a subform based on a QueryDef (created from values in several combo boxes.)  When I click my command button, the querydef is created correctly.  However, my "me.subformname.requery" command isn't doing it's job (the new results don't display.)

    I can do this successfully using a List Box.  However, I'd rather use a subform.

    I've played with all sorts of "requery" and "refresh" combinations, but no luck.  Is it possible that subforms based on a QueryDef don't work?

    Thanks!

    UPDATE!  UPDATE!  UPDATE!  UPDATE!  UPDATE!  UPDATE!  UPDATE!  UPDATE!  UPDATE!

    For some reason, I'm not able to reply to your messages.  Thus, the reason for this edit.

    First of all, thank you for your help.  I had previously used:

        Me.frmBillingManagerSubform.Requery

    but to no avail.  So, I tried the following:        

        temp = ""
        temp = frmBillingManagerSubform.SourceObject
        frmBillingManagerSubform.SourceObject = temp

    and this worked.  Thanks again! 

    BTW, when I tried to reply, the form opens but doesn't let me enter text.  Any ideas?


    • Edited by Kenrav Wednesday, February 5, 2020 8:28 PM
    Wednesday, February 5, 2020 2:26 AM

All replies

  • No, that is not possible.

    Rather than "me.subformname.requery"

    use:

    me.subformControlname.requery


    -Tom. Microsoft Access MVP


    Wednesday, February 5, 2020 5:15 AM
  • me.subformControlname.requery

    Hi Kenrav,

    In addition to Tom you could also try:

        Me.SubformControlname.Form.Requery

    Imb.


    • Edited by Imb-hb Wednesday, February 5, 2020 6:38 AM
    • Proposed as answer by Gustav BrockMVP Wednesday, February 5, 2020 7:00 PM
    Wednesday, February 5, 2020 6:37 AM
  • Just so you are absolutely clear, 'SubformControlName' in:

        Me.SubformControlName.Requery

    is the name of the control in the parent form which  'houses' the subform.  This might or might not be the same as the name of its source form object, but to avoid ambiguity, is better not.  I generally prefix a subform control name with sfc, and the name of a form to be used as a subform with frmSub.

    Ken Sheridan, Stafford, England

    Wednesday, February 5, 2020 6:16 PM