Consulting

Results 1 to 2 of 2

Thread: Update text field in Multipage container

  1. #1

    Update text field in Multipage container

    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:
    [vba]
    frmCBRWorkflow.Controls("txtCustStrat1").Text = txtStrategiesUse.Text
    frmCBRWorkflow.txtCustStrat1.Text = txtStrategiesUse.Text
    frmCBRWorkflow.MultiPage1.Controls("txtCustStrat1").Text = txtStrategiesUse.Text
    frmCBRWorkflow.MultiPage1.txtCustStrat1.Text = txtStrategiesUse.Text
    [/vba]
    I am able to return page count using:
    [vba]frmCBRWorkflow.MultiPage1.Pages.Count[/vba]
    Also, I tested this scenario with a form (UserForm1) which does not have a Multipage object on it and it works... as follows:

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

    Thanks

  2. #2

    Close but no Cigar

    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.

    Any Suggestions?

    [VBA]
    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
    [/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •