requery a sub form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacc14
    New Member
    • Jun 2007
    • 116

    requery a sub form

    Hi.

    Hope someone can help with the query which seems relatively easy yet I cant get it to work.

    I have a main form and when I enter a figure "after update" i want another figure to be updated. The figure I want updated is a box in a subform within another subform. I have tried requery but it only refreshes the first subform.

    Hope this makes sense.

    Thanks

    jacc14
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi. Subforms on main forms are treated as controls like any other. Their form properties are accessed using the Form qualifier. Assuming that the code for requerying your forms is in the outermost form (the main form) the requery of the nested subform can be done like this:

    Code:
    Me!firstcontrol.Form!secondcontrol.Form.Requery


    replacing firstcontrol and secondcontrol with the actual names of your subform controls as used in your forms.

    -Stewart

    Comment

    • jacc14
      New Member
      • Jun 2007
      • 116

      #3
      Hi Stewart
      Thanks for the prompt reply. Unfortunately I have tried this and whilst it kicks up no errors the TOTAL field in the second subform does not change value.

      Do I need to requery the actual field as well?

      Thanks
      jacc14

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        You may need to requery the first subform before you requery the second. Sorry to say it is difficult to advise without seeing how the total field is calculated (is it an unbound calculated field, a DSUM, or what)?

        -Stewart

        Comment

        • jacc14
          New Member
          • Jun 2007
          • 116

          #5
          Hi Dont worry I have used your original advise and it now seems to have worked. Think I didnt do it right first time doh

          Thanks
          jacc14

          Comment

          Working...