use an expression as a control name

D

Dan

Is there a way to programaticaly build a control name.

For example: Suppose I have a form with 10 text boxes
named:
txtBox1
txtBox2
txtBox3
..
..
..
txtBox10

I need code that accomplishes something similar to this:

Dim i as integer
i = 1

Do While i<10

txtBox & i = dLookup("Value", "tblValues", "ID = " & i
& "")

i = i+1
Loop

''''''''''''''

So essential I need code that makes it so I don't have to
do
txtBox1 = dLookup("Value", "tblValues", "ID = 1")
txtBox2 = dLookup("Value", "tblValues", "ID = 2")
..
..
txtBox10 = dLookup("Value", "tblValues", "ID = 10")

Any suggestions?

Thanks,
Dan
 

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