Consulting

Results 1 to 3 of 3

Thread: Solved: Values to Text

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Solved: Values to Text

    I have a Form that need to take the data and add it to another form.

    Example (UserForm2)

    CmbBoxBO1 TxtqtyBo1
    CmbBoxBO2 TxtqtyBo2
    CmbBoxBO3 TxtqtyBo3
    CmbBoxBO4 TxtqtyBo4
    CmbBoxBO5 TxtqtyBo5
    CmbBoxBO6 TxtqtyBo6
    CmbBoxBO7 TxtqtyBo7
    CmbBoxBO8 TxtqtyBo8

    This is the way the form layout is. I need to pull the values from this form into 1 TxtBox in this form.

    UserForm1.TxtComments.Text = UserForm2.CmbBoxBO1.Value & " " & TxtqtyBo1.txt & ";" & UserForm2.CmbBox2.Value & TxtqtyBo2 & " " ....

    Until TxtqtyBo8.

    If it can test for value's or just grab from visible values so it doesn't go threw all values because some will be blank.

    Example
    Many cases one CmbBO1 and TxtqtyBo1 will be used, so it should just grab those and not grab the otherones.
    I set it up only boxes visible are the one's with data, maybe that can help.

    Any help would be great.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim tmp As String

    With UserForm2

    For i = 1 To 8

    If .Controls("CmbBoxBO" & i).Value <> "" Then

    tmp = tmp & .Controls("CmbBoxBO" & i).Value & " "
    End If
    If .Controls("TxtqtyBo" & i).Text <> "" Then
    tmp = tmp & .Controls("TxtqtyBo" & i).Text & ";"
    End If
    Next i
    End With

    UserForm1.TxtComments.Text = tmp
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    That looks great xld Thanks.

Posting Permissions

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