Requery subform (not linked)

  • Thread starter Thread starter Tim Hart
  • Start date Start date
T

Tim Hart

Guest
How can I requery a subform with a chart, when I change parameters in the main form? The subform is NOT linked with the form! This code does not work:

Private Sub Form_Current()
[Subform_Chart].Requery
End Sub

also this one does not work:
Forms!F_Menu.Refresh
Forms!F_Menu.Requery

Thanks for your help!
Tim
 
Tim,
I am not sure what you want done, however, on the fields that you use in the main form to update the subform, on the Gotfocus and Lostfocus events you can put in "Me.Refresh". Alternatively the same code can be put in the Change event meaning when the user presses the enter key the subform will refresh.

Best Regards,
Chris
 
Do you have both forms open at the same time?
If so you can use the IsOpen function
You can add this to any button or close event

If IsOpen("SubFormname") Then
Forms![SubFormname].Refresh
End If

--------

Public Function IsOpen(ByVal strFormName As String) As Boolean
Const conDesignView = 0
Const conObjStateClosed = 0

IsOpen = False
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsOpen = True
End If
End If

End Function
 

Users who are viewing this thread

Back
Top Bottom