Re-freshing Form and Subforms

ardy

Registered User.
Local time
Today, 15:12
Joined
Sep 24, 2012
Messages
98
Hello All:
I have two forms, A and B. Form A is detail info of students. From Form A I am opening Form B to Add assigned tests. Once I Save and close Form B, I like to Re-freash form A so the record that was just entered in Form B shows up in Form A subform.
I am not sure under what event in form A I need the following vb code, I have tried couple but it’s not working…….. any ideas……
Code:
    Forms![frm_Students_Details].Form.Requery
    Forms![frm_Students_Details].[Assignment subform].Form.Requery
    Forms![frm_Students_Details].[Tests subform].Form.Requery
 
Try the On Close event of Form B or if you are using a Close button on Form B, then put this in the Button's On Click event.
 
Thanks........
 
Because in my case Form B can be accessed through several forms and can be used to change or add records I set Action to "A" Amend Exhibition or "O" for Originals and "P" for Prints and do this:

Code:
Function Exhibitions_Activate()

    With CodeContextObject
        If IsNull(.[Action]) Then
            Exit Function
        ElseIf .[Action] = "A" Then
            DoCmd.RepaintObject acForm, "Exhibitions Entry"
        ElseIf .[Action] = "O" Then
            DoCmd.Requery "Exhibitions Originals"
        ElseIf .[Action] = "G" Then
            DoCmd.Requery "Exhibitions Prints"
        End If
        .[Action] = Null
    End With
End Function

Simon
 

Users who are viewing this thread

Back
Top Bottom