C
chris
I am opening a form called frmFindPerson from a form called
frmEditPerProj. I am passing the form name of the first form to the
second form by placeing it in openArgs in doCmd.OpenForm as
"frmEditPerProj".
I want to select a record from the second form and pass a field value
back to the first using the form name passed in OpenArgs to define the
field to be filled with this data. I was not sure whether I could use
OpenArgs dircetly so I have set up a variable and assigned the value
of OpenArgs to it as follows
Private Sub cmdSelect_Click()
Dim strFormName As String
strFormName = Forms!frmfindPerson.OpenArgs
In order to check that the variable contains the form name I added the
following which does confirm this
MsgBox ("OpenArgs is " & strFormName)
I then want to use this value to fill a field on the first form with
data from the second. I have tried using the following and various
variations on it with and without brackets/quotes etc but nothing
works
Forms![strFormName]!PersonID.Value = Me!PersonID
If however if I put the name of the first form (frmEditPerProj) into
the line instead of strFormName it does work.
What am I doing wrong? I want to do this using openArgs as I want to
use the form frmFindPerson, for many different situations and this
seemed a good way of using generic code to suit all these situations.
Perhaps someone can suggest another solution if I am barking up the
wrong tree.
Chris
frmEditPerProj. I am passing the form name of the first form to the
second form by placeing it in openArgs in doCmd.OpenForm as
"frmEditPerProj".
I want to select a record from the second form and pass a field value
back to the first using the form name passed in OpenArgs to define the
field to be filled with this data. I was not sure whether I could use
OpenArgs dircetly so I have set up a variable and assigned the value
of OpenArgs to it as follows
Private Sub cmdSelect_Click()
Dim strFormName As String
strFormName = Forms!frmfindPerson.OpenArgs
In order to check that the variable contains the form name I added the
following which does confirm this
MsgBox ("OpenArgs is " & strFormName)
I then want to use this value to fill a field on the first form with
data from the second. I have tried using the following and various
variations on it with and without brackets/quotes etc but nothing
works
Forms![strFormName]!PersonID.Value = Me!PersonID
If however if I put the name of the first form (frmEditPerProj) into
the line instead of strFormName it does work.
What am I doing wrong? I want to do this using openArgs as I want to
use the form frmFindPerson, for many different situations and this
seemed a good way of using generic code to suit all these situations.
Perhaps someone can suggest another solution if I am barking up the
wrong tree.
Chris