• Syntax to Requery a form (2000 SP3)

    Author
    Topic
    #394696

    I have an unbound form Group Management which has three tabs on it holding other forms used to accomplish various tasks: Tab 1 – Printing reports; Tab 2 Adding people to various groups (frmMembershipGroups with a subform sbfrmMembershipGroups); Tab 3 – editing, adding and deleting group definitions(frmCommittee/GroupDefinitions).

    Tab 2 and 3 each have a combo box used to lookup records on that form, Combo 7 & 8. If I delete a group out of the frmCommittee/GroupDefinitions, how can I get frmMembershipGroups and the two combo boxes to requery and update themselves?

    I tried using the requery method following the syntax in VBA help and I just get #Deleted showing up.
    Here is the code I used on the from frmCommittee/GroupDefinition

    Private Sub Form_AfterUpdate()
    Dim Rst As Recordset
    Dim ctl1 As Control
    Dim ctl2 As Control
    ‘ Return Control object pointing to list box.
    Set Rst = Queries!qrycommittee
    ctl1 = Forms![frmGroup Management]![frmCommittee/GroupDefinition]!Combo7
    ctl2 = Forms![frmGroup Management]!frmMembershipGroups!Combo8
    ‘ Requery source of data for list box.
    Rst.Requery
    ctl1.Requery
    ctl2.Requery
    End Sub

    Peter

    Viewing 1 reply thread
    Author
    Replies
    • #725536

      You can’t set a recordset to a query, and I don’t know why you would want to requery a stored query.

      If I understand you correctly, frmGroup Management is the main form. If so, you don’t have to refer to controls on it with Forms![frmGroup Management]!…, you can use Me!… instead.

      If you want to requery a subform, you must specify it like this:

      Me.frmMembershipGroups.Form.Requery

      To requery a combo box on a subform, use an instruction like this:

      Me.frmMembershipGroups.Form.Combo8.Requery.

      See Refer to Form and Subform properties and controls on the Access web for a comprehensive overview.

      • #726096

        Thanks for the reference to the table on The Access Web. It took a couple of tries and a bit of logic, but I got things working properly. Ironically, I had downloaded the form on my home computer in the summer because I thought it would be useful woops and forgot about it! I now have it at work as well.

        Peter

      • #726097

        Thanks for the reference to the table on The Access Web. It took a couple of tries and a bit of logic, but I got things working properly. Ironically, I had downloaded the form on my home computer in the summer because I thought it would be useful woops and forgot about it! I now have it at work as well.

        Peter

    • #725537

      You can’t set a recordset to a query, and I don’t know why you would want to requery a stored query.

      If I understand you correctly, frmGroup Management is the main form. If so, you don’t have to refer to controls on it with Forms![frmGroup Management]!…, you can use Me!… instead.

      If you want to requery a subform, you must specify it like this:

      Me.frmMembershipGroups.Form.Requery

      To requery a combo box on a subform, use an instruction like this:

      Me.frmMembershipGroups.Form.Combo8.Requery.

      See Refer to Form and Subform properties and controls on the Access web for a comprehensive overview.

    Viewing 1 reply thread
    Reply To: Syntax to Requery a form (2000 SP3)

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

    Your information: