Solved: Combining Multiple Textboxes
I found the code for taking the text in multiple textboxes, and combining it into one textbox. I was able to successfully do that however, I am now trying to also copy in the label in front of the textbox as well.
Please see my example below, and let me know if you could be of any help. Thanks!
desired results in 1 textbox (both the label and textbox contents combined):
field1: my
field2: name
field3: is
my results:
field1: my
field1: name
field2: name
field2: is
field3: is
my code:
[VBA] Private Sub Command9_Click()
Dim PText As Control
Dim Temp As String
Dim label As String
Dim combine As String
Dim combine2 As String
For Each PText In Me.Controls
If InStr(1, PText.Name, "lbl") > 0 Then
label = PText.Caption
ElseIf InStr(1, PText.Name, "field") > 0 Then
PText.SetFocus
Temp = PText.Text
End If
combine = label & Temp & vbCrLf
combine2 = combine2 & combine
Next PText
Text6.SetFocus
Text6.Text = combine2
End Sub[/VBA]