indirect value

G

Guest

Hi,
On a form there are 12 text box named UP1 to UP12. The user enter text in
these box when we click on a calculate button, the values from UP1 will be
transferred to UR1 and so on. I used a loop to generate the text box named. A
sample file is attached for 5 text box.
Please help me how I can write a vb to generate the forms reference
(Forms!testing!UP1) and so on.
Thanks.

Private Sub Calculate_Click()
Dim counter As Integer
Dim formname As String
Dim temp As String

counter = 1
Do While counter <= 5
formname = "Forms!testing!UP"
formname = formname & counter
counter = counter + 1
Me.UR1 = formname
Stop
Loop
End Sub
 
D

Douglas J. Steele

Private Sub Calculate_Click()
Dim counter As Integer

counter = 0
Do While counter < 5
counter = counter + 1
Me.Controls("UR" & counter) = Me.Controls("UP" & counter)
Loop

End Sub
 

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