• Requery Of SubForm Based On A Query (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Requery Of SubForm Based On A Query (Access 2000)

    Author
    Topic
    #360674

    I have a form containing a sub-from, the sub-form having as its source a query that picks up criteria from the main form.

    I am having difficulty finding the right macro command to get the sub-form to requery its query. For example, if I jump to second form and do something that would change the results of the query in question, I want to see that change when I go back to the first form.

    The standard Requery macro command just doesn’t seem to work with sub-forms, or fields within sub-forms.

    Viewing 2 reply threads
    Author
    Replies
    • #543646

      Hi

      Can you not set the LinkChild, LinkMaster properties of the subform to the primary keyfield of the main form ?

      Failing that can you set an event for the main form
      maybe onCurrent
      to requery the subform
      e.g
      sub frmMain_OnCurrent
      forms!frmmainForm!frmSubForm.requery
      end sub

      Hope this helps
      Cheers
      Geof

    • #543648

      It sounds like you’re using an unbound subform and keeping it in sync the hard way. As has already been suggested, the Master and Child links would be the simplest way to keep them in sync and wouldn’t require any requerying. However, in case you *do* need to requery, there are methods to do so.

      Are you requerying it from the parent form, from another subform or from another form altogether?

      If you want to requery it from the parent form, use this syntax: Me!SubformControl.requery. Subformcontrol represents the name of the subform control on your parent form.

      If you want to requery it from another subform on the same form, the syntax is: Parent!SubformControl.requery.

      If you want to requery it from another form altogether, the syntax is Forms!Mainform!SubformControl.requery, where MainForm is the name of the parent form.

      If you’re looking for the proper event to use, it depends on what you’re doing. Usually, the AfterUpdate event of the form or subform would be my choice.

    • #543649

      It sounds like you’re using an unbound subform and keeping it in sync the hard way. As has already been suggested, the Master and Child links would be the simplest way to keep them in sync and wouldn’t require any requerying.

      However, in case you do need to requery, there are methods to do so, but you’ll probably need to do it from code. You’ll need a SelectObject action first to make your subform’s parent the activeobject then a Requery action, and the Control Name should be the name of the subform control. Then you’ll have to figure out what event on which form to use to call the macro.

      Are you requerying it from the parent form, from another subform or from another form altogether?

      If you’re looking for the proper event to use, it depends on what you’re doing. Usually, the AfterUpdate event of the form or subform would be my choice.

    Viewing 2 reply threads
    Reply To: Requery Of SubForm Based On A Query (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: