Private OpenedFromForm as form
And in the popup forms OPEN event:Set OpenedFormForm=Screen.ActiveControl.Parent
Then when you need anything from the OpenedFromForm, you can get it by that reference, eg.Set RS=OpenedFromForm.recordsetclone
(Note that while testing/designing the open event will not fire if the form is already open in design view. So if you make changes to the popup form, save it, and close it before testing)
Set Me.Form.Recordset = Forms("ProjectForm").Form.Controls("Details").Form.RecordsetClone
Option Compare Database
Option Explicit
Private Sub btnOpenArgs_Click()
DoCmd.OpenForm "OpenArgs", , , , , , Me.Form.Name & ";" & sfmData.Name
End Sub
withOption Compare Database
Option Explicit
Private Sub Form_Load()
Dim Args() As String
Args() = Split(Me.Form.OpenArgs, ";")
If UBound(Args()) = 0 Then
Set Me.Form.Recordset = Forms(Args(0)).Form.RecordsetClone
Else
Set Me.Form.Recordset = Forms(Args(0)).Form.Controls(Args(1)).Form.RecordsetClone
End If
End Sub
Open in new window
Depending on the use-case, the form name of the base form can be passed as an OpenArgs value.