pass fields to pop up form

D

deb

I have a main form called fEdit and a subform called fEditDetails.
fEditDetails form has many buttons. If the user chooses btn10 a popup form
is displayed with an area the user can make a note why he selected btn 10.

If user clicks button btn10 a pop up form called fEditPopUp is displayed.
I need to automatically populate the popup form with EditDetailsID and the
number 10.

How can I autopopulate the popup with the EditDetailsID into EditDetailsID
field and the number 10 in the ListID field?

Thanks
 
D

Dale Fye

To pass the value of the button that was pushed, you could use the OpenArgs
parameter of the OpenForm method. It is the last parameter in the parameter
list. Then, in the forms Open event, check to see if there is a OpenArg
value and if so, put it in the appropriate field of that form.

If fEditPopup is bound to a table that contains the EditDetailsID field,
then you can pass that as the WhereCondition parameter of the OpenForm
method. It might look like:

Private sub Btn10_Click

strCriteria = "[EditDetailsID] = " & me.txt_EditDetailsID
strOpenArgs = 10
docmd.OpenForm "fEditPopUp",,,strCriteria,,,strOpenArgs

End Sub

If fEditPopup is not bound, then you might want to pass both values in
strOpenArgs (separated by a comma or semi-colon). Then, in the forms Open or
Load event, use the Split() function to parse the two elements of OpenArgs
and then put the values in the appropriate fields.
 
D

deb

Thank you
I tried what you send but.

This passed the EditDetailsID as 10. I need EditDetailsID to be sent to
EditDetailsID and the number 10 sent to ListID

I amnot sure how to user Split() . Can you spell it out for me.

This is the first time trying to send data to a pop up form.

Thanks
--
deb


Dale Fye said:
To pass the value of the button that was pushed, you could use the OpenArgs
parameter of the OpenForm method. It is the last parameter in the parameter
list. Then, in the forms Open event, check to see if there is a OpenArg
value and if so, put it in the appropriate field of that form.

If fEditPopup is bound to a table that contains the EditDetailsID field,
then you can pass that as the WhereCondition parameter of the OpenForm
method. It might look like:

Private sub Btn10_Click

strCriteria = "[EditDetailsID] = " & me.txt_EditDetailsID
strOpenArgs = 10
docmd.OpenForm "fEditPopUp",,,strCriteria,,,strOpenArgs

End Sub

If fEditPopup is not bound, then you might want to pass both values in
strOpenArgs (separated by a comma or semi-colon). Then, in the forms Open or
Load event, use the Split() function to parse the two elements of OpenArgs
and then put the values in the appropriate fields.

----
HTH
Dale



deb said:
I have a main form called fEdit and a subform called fEditDetails.
fEditDetails form has many buttons. If the user chooses btn10 a popup form
is displayed with an area the user can make a note why he selected btn 10.

If user clicks button btn10 a pop up form called fEditPopUp is displayed.
I need to automatically populate the popup form with EditDetailsID and the
number 10.

How can I autopopulate the popup with the EditDetailsID into EditDetailsID
field and the number 10 in the ListID field?

Thanks
 
D

Dale Fye

What did you try, the first recommendation, or the 2nd?

If you are trying the second, you might do something like:

Private Sub btn10_Click

Dim strOpenArgs as string

strOpenArgs = me.txt_EditDetailsID & ";" & "10"
docmd.openform "fEditPopUp",,,,,,strOpenArgs

End Sub

Then, in the Load event of fEditPopUp, you might do something like:

Private sub Form_Load

Dim strArray(2) as string

strArray = Split(me.Openargs, ";")

me.txt_EditDetailsID = strArray(0)
me.txt_ListID = strArray(1)

End Sub

----
HTH
Dale



deb said:
Thank you
I tried what you send but.

This passed the EditDetailsID as 10. I need EditDetailsID to be sent to
EditDetailsID and the number 10 sent to ListID

I amnot sure how to user Split() . Can you spell it out for me.

This is the first time trying to send data to a pop up form.

Thanks
--
deb


Dale Fye said:
To pass the value of the button that was pushed, you could use the OpenArgs
parameter of the OpenForm method. It is the last parameter in the parameter
list. Then, in the forms Open event, check to see if there is a OpenArg
value and if so, put it in the appropriate field of that form.

If fEditPopup is bound to a table that contains the EditDetailsID field,
then you can pass that as the WhereCondition parameter of the OpenForm
method. It might look like:

Private sub Btn10_Click

strCriteria = "[EditDetailsID] = " & me.txt_EditDetailsID
strOpenArgs = 10
docmd.OpenForm "fEditPopUp",,,strCriteria,,,strOpenArgs

End Sub

If fEditPopup is not bound, then you might want to pass both values in
strOpenArgs (separated by a comma or semi-colon). Then, in the forms Open or
Load event, use the Split() function to parse the two elements of OpenArgs
and then put the values in the appropriate fields.

----
HTH
Dale



deb said:
I have a main form called fEdit and a subform called fEditDetails.
fEditDetails form has many buttons. If the user chooses btn10 a popup form
is displayed with an area the user can make a note why he selected btn 10.

If user clicks button btn10 a pop up form called fEditPopUp is displayed.
I need to automatically populate the popup form with EditDetailsID and the
number 10.

How can I autopopulate the popup with the EditDetailsID into EditDetailsID
field and the number 10 in the ListID field?

Thanks
 
D

deb

On this... I get a compiler error - Can't Assign to array

Dim strArray(2) As String

strArray = Split(Me.OpenArgs, ";")

Me.DetailsID = strArray(0)
Me.ListID = strArray(1)



--
deb


Dale Fye said:
What did you try, the first recommendation, or the 2nd?

If you are trying the second, you might do something like:

Private Sub btn10_Click

Dim strOpenArgs as string

strOpenArgs = me.txt_EditDetailsID & ";" & "10"
docmd.openform "fEditPopUp",,,,,,strOpenArgs

End Sub

Then, in the Load event of fEditPopUp, you might do something like:

Private sub Form_Load

Dim strArray(2) as string

strArray = Split(me.Openargs, ";")

me.txt_EditDetailsID = strArray(0)
me.txt_ListID = strArray(1)

End Sub

----
HTH
Dale



deb said:
Thank you
I tried what you send but.

This passed the EditDetailsID as 10. I need EditDetailsID to be sent to
EditDetailsID and the number 10 sent to ListID

I amnot sure how to user Split() . Can you spell it out for me.

This is the first time trying to send data to a pop up form.

Thanks
--
deb


Dale Fye said:
To pass the value of the button that was pushed, you could use the OpenArgs
parameter of the OpenForm method. It is the last parameter in the parameter
list. Then, in the forms Open event, check to see if there is a OpenArg
value and if so, put it in the appropriate field of that form.

If fEditPopup is bound to a table that contains the EditDetailsID field,
then you can pass that as the WhereCondition parameter of the OpenForm
method. It might look like:

Private sub Btn10_Click

strCriteria = "[EditDetailsID] = " & me.txt_EditDetailsID
strOpenArgs = 10
docmd.OpenForm "fEditPopUp",,,strCriteria,,,strOpenArgs

End Sub

If fEditPopup is not bound, then you might want to pass both values in
strOpenArgs (separated by a comma or semi-colon). Then, in the forms Open or
Load event, use the Split() function to parse the two elements of OpenArgs
and then put the values in the appropriate fields.

----
HTH
Dale



:

I have a main form called fEdit and a subform called fEditDetails.
fEditDetails form has many buttons. If the user chooses btn10 a popup form
is displayed with an area the user can make a note why he selected btn 10.

If user clicks button btn10 a pop up form called fEditPopUp is displayed.
I need to automatically populate the popup form with EditDetailsID and the
number 10.

How can I autopopulate the popup with the EditDetailsID into EditDetailsID
field and the number 10 in the ListID field?

Thanks
 
D

deb

Tried and it works

If Me.NewRecord Then
Me.[DetailsID] = Split(Me.OpenArgs, "$")(0)
Me.[ListID] = Split(Me.OpenArgs, "$")(1)
End If
--
deb


deb said:
On this... I get a compiler error - Can't Assign to array

Dim strArray(2) As String

strArray = Split(Me.OpenArgs, ";")

Me.DetailsID = strArray(0)
Me.ListID = strArray(1)



--
deb


Dale Fye said:
What did you try, the first recommendation, or the 2nd?

If you are trying the second, you might do something like:

Private Sub btn10_Click

Dim strOpenArgs as string

strOpenArgs = me.txt_EditDetailsID & ";" & "10"
docmd.openform "fEditPopUp",,,,,,strOpenArgs

End Sub

Then, in the Load event of fEditPopUp, you might do something like:

Private sub Form_Load

Dim strArray(2) as string

strArray = Split(me.Openargs, ";")

me.txt_EditDetailsID = strArray(0)
me.txt_ListID = strArray(1)

End Sub

----
HTH
Dale



deb said:
Thank you
I tried what you send but.

This passed the EditDetailsID as 10. I need EditDetailsID to be sent to
EditDetailsID and the number 10 sent to ListID

I amnot sure how to user Split() . Can you spell it out for me.

This is the first time trying to send data to a pop up form.

Thanks
--
deb


:

To pass the value of the button that was pushed, you could use the OpenArgs
parameter of the OpenForm method. It is the last parameter in the parameter
list. Then, in the forms Open event, check to see if there is a OpenArg
value and if so, put it in the appropriate field of that form.

If fEditPopup is bound to a table that contains the EditDetailsID field,
then you can pass that as the WhereCondition parameter of the OpenForm
method. It might look like:

Private sub Btn10_Click

strCriteria = "[EditDetailsID] = " & me.txt_EditDetailsID
strOpenArgs = 10
docmd.OpenForm "fEditPopUp",,,strCriteria,,,strOpenArgs

End Sub

If fEditPopup is not bound, then you might want to pass both values in
strOpenArgs (separated by a comma or semi-colon). Then, in the forms Open or
Load event, use the Split() function to parse the two elements of OpenArgs
and then put the values in the appropriate fields.

----
HTH
Dale



:

I have a main form called fEdit and a subform called fEditDetails.
fEditDetails form has many buttons. If the user chooses btn10 a popup form
is displayed with an area the user can make a note why he selected btn 10.

If user clicks button btn10 a pop up form called fEditPopUp is displayed.
I need to automatically populate the popup form with EditDetailsID and the
number 10.

How can I autopopulate the popup with the EditDetailsID into EditDetailsID
field and the number 10 in the ListID field?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top