Refresh subform from a different form (1 Viewer)

brharrii

Registered User.
Local time
Yesterday, 18:43
Joined
May 15, 2012
Messages
272
I have an close button on a form that is supposed to Refresh the subform of a different form and then close the form with the close button.

frmOperations - no refresh / requery
subfrmPlants - Needs to be refreshed / requeried

frmPlants - Needs to be closed

Currently the button effectively closes frmPlants, but it's failing to refresh the data on my subform to display any changes that have been made on frmPlants.

can anyone tell what I'm doing wrong? I've tried with refresh and requery, neither seem to work.
Code:
Private Sub lblClose_Click()
    If CurrentProject.AllForms("frmOperations").IsLoaded Then
        Forms!frmOperations!subfrmPlants.Form.Refresh
    End If
 
    DoCmd.Close acForm, "frmPlants", acSavePrompt
End Sub

Thanks!
 

ByteMyzer

AWF VIP
Local time
Yesterday, 18:43
Joined
May 3, 2004
Messages
1,409
Try changing the highlighted code:
Code:
Private Sub lblClose_Click()
    If CurrentProject.AllForms("frmOperations").IsLoaded Then
        Forms!frmOperations!subfrmPlants.Form.[B][I][COLOR="Red"]Requery[/COLOR][/I][/B]
    End If
 
    DoCmd.Close acForm, "frmPlants", acSavePrompt
End Sub
 

brharrii

Registered User.
Local time
Yesterday, 18:43
Joined
May 15, 2012
Messages
272
I thought I had tried that.... but apparently i had made another tweek between trying refresh and requery as well. That worked perfectly.

Thank you!
 

Users who are viewing this thread

Top Bottom