PDA

View Full Version : Update text field in Multipage container



dumbpuppy
04-24-2008, 10:55 AM
I have a text field on page 2 of a Multipage object (FORM). I have a button next to the text field which opens another form who's job it is to ultimately provide the value and update the text field on the original (calling form).

Example:
Base Form Name = frmCBRWorkflow (parent form)
MultiPage object name = Multipage1
FieldName on frmCBRWorkflow = txtCustStrat1
FieldName on child form which has desired text value = txtStrategiesUse

I want to update txtCustStrat1 (parent form) = txtStrategiesUse (child form)

Following is some syntax which fails:

frmCBRWorkflow.Controls("txtCustStrat1").Text = txtStrategiesUse.Text
frmCBRWorkflow.txtCustStrat1.Text = txtStrategiesUse.Text
frmCBRWorkflow.MultiPage1.Controls("txtCustStrat1").Text = txtStrategiesUse.Text
frmCBRWorkflow.MultiPage1.txtCustStrat1.Text = txtStrategiesUse.Text

I am able to return page count using:
frmCBRWorkflow.MultiPage1.Pages.Count
Also, I tested this scenario with a form (UserForm1) which does not have a Multipage object on it and it works... as follows:

UserForm1.TextBox1.Text = txtStrategiesUse.Text
I am still working on it... Anyone have any pearls of wisdom please share.

Thanks

dumbpuppy
04-24-2008, 01:35 PM
OK,
I've just about got it working...
The issue now is that the line "mObj.Pages(2).Controls(i).Text = txtStrategiesUse.Text" is not updating the value even though all the code pasted below is working perfectly. :dunno

Any Suggestions?


Private Sub btnPostStrategies_Click()
Dim mObj As MultiPage
Dim i As Long
Dim PageName As String
Dim strObjName As String
Dim strTemp As String

Set mObj = frmCBRWorkflow.MultiPage1

For i = 0 To mObj.Pages(2).Controls.Count - 1
strObjName = mObj.Pages(2).Controls(i).name
If strObjName = "txtCustStrat1" Then
strTemp = mObj.Pages(2).Controls(i).Text
MsgBox "Current text on Parent form: " & strTemp
'The following line is not updateing value
mObj.Pages(2).Controls(i).Text = txtStrategiesUse.Text
Exit For
End If
Next i

End Sub