Hi,
I would like to use a pop-up form from different forms and need to get the name of the form from which the pop-up has been opened.
The purpose is, that when closing the pop-up again I need to requery this form.
As I need further two values as Openargs for the pop-up I tried this:
From the form I open the pop-up form (called "frmEmployee") and generate the Openargs.
My problem is that I start the code from a subform and I cannot get name of the control, holding the subform.
Screen.ActiveControl.Form.Name.. brings me null
Screen.ActiveControl.Form... brings an error
Screen.ActiveForm.Name...brings the name of the subform
I need to know the forms name for the requery of the form I started from in the pop-up.
The code in the pop-up looks like this:
'"strFormName" should be the second part of the Openargs, which allows to requery the form, from which the pop-up was opened - this I cannot solve, this should be something like
"Forms!frmBestellungenTage!frmBestellungenTagMinusEins.Form.Requery" without the requery, as this comes from the Docmd.Requery(...)
I would appreciate any help on this!
Thanks
Michael
I would like to use a pop-up form from different forms and need to get the name of the form from which the pop-up has been opened.
The purpose is, that when closing the pop-up again I need to requery this form.
As I need further two values as Openargs for the pop-up I tried this:
From the form I open the pop-up form (called "frmEmployee") and generate the Openargs.
Code:
Private Sub Employee_Click()
Dim strOpenargs As String
On Error Resume Next
strOpenargs = "Forms!frmBestellungenTage!" & Screen.ActiveForm.Form.Name & ".Form"
Debug.Print strOpenargs
DoCmd.OpenForm "frmEmployee", , , , , , Me.BesttagID & ";" & strOpenargs
End Sub
My problem is that I start the code from a subform and I cannot get name of the control, holding the subform.
Screen.ActiveControl.Form.Name.. brings me null
Screen.ActiveControl.Form... brings an error
Screen.ActiveForm.Name...brings the name of the subform
I need to know the forms name for the requery of the form I started from in the pop-up.
The code in the pop-up looks like this:
Code:
Private Sub Employee_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE tblBestellungstage set WPID = " & Me.Employee.Column(0) & " WHERE BesttagID = " & CLng(strValue) & ";"
'Clng(strValue) is the first part of the Openargs, this works!
Call SQL_PassThrough(strSQL)
DoCmd.Requery (strFormName)
DoCmd.Close acForm, Me.Name
End sub
'"strFormName" should be the second part of the Openargs, which allows to requery the form, from which the pop-up was opened - this I cannot solve, this should be something like
"Forms!frmBestellungenTage!frmBestellungenTagMinusEins.Form.Requery" without the requery, as this comes from the Docmd.Requery(...)
I would appreciate any help on this!
Thanks
Michael
Last edited: