requery form

benjamin.weizmann

Registered User.
Local time
Today, 04:24
Joined
Aug 30, 2016
Messages
78
hi :)
I'll do my best explain all my stages:

1. I made a query

2. I made a form (from1) based on this query
when clicking on record, form2 opens.

3. I made from this form1 a same sub-form (subform1) for 2 different forms (from3, from4)

4. when exit from from2 I want to requery:
subfrom1 of from3 if I arrived to form2 by form3 or
subform1 of form4 if I arrived to from2 by form4

how can I do it please?

thanks u so much

Ben
 
i cannot follow, but the syntax
that you will be using on the Close Event
of the form that is Exiting is:

[Forms]![MainFormName]![SubFormNameToRequery].Form.Requery

eg:

Private Sub Form_Close(Cancel As Integer)
[Forms]![MainFormName]![SubFormNameToRequery].Form.Requery
End Sub
 
i cannot follow, but the syntax
that you will be using on the Close Event
of the form that is Exiting is:

[Forms]![MainFormName]![SubFormNameToRequery].Form.Requery

eg:

Private Sub Form_Close(Cancel As Integer)
[Forms]![MainFormName]![SubFormNameToRequery].Form.Requery
End Sub

thanks you
I know it but... on close event ..how I can requery the parent (source-form) generally (without knowing the specific parent) or how can I following which was the parent -form ?

thanks
Ben
 
on opening the Child form, passed the name
of the Parent form as a parameter (OpenArgs):

eg, say you are opening "Form2" from "FormMain":

DoCmd.OpenForm Formname:="Form2",View:=acNormal,OpenArgs:=Me.Name

Me.Name (the name of the parent invoking form) is passed to
the invoked form. then in the invoked form (Form2) catches
this value and can be used on its Close Event:

Private Sub Form_Close()

If Trim(Me.OpenArgs & "") <> "" Then
' add code to test which Parent
' this belongs and Requery its appropriate
' subform
IF Me.OpenArgs = "Form1" Then
Form(Me.OpenArgs)("subFormOfNameForm1").Form.Requery
End If

' check for other Forms
IF Me.OpenArgs = "Form3" Then
Form(Me.OpenArgs)("subFormOfNameOfForm3").Form.Requery
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom