Syntax for using a variable as part of an object name.

S

smithrn01

I have 10 cells named UI1 through UI10. I want to put data into the
cells through a For loop. What is the proper syntax to use a variable
as part of the object name?

In the sample below, CELL1 is a variable whose value is the name of
the field where I want to enter data. I need to have VB recognize the
value of the variable as the field name.


Dim Cell1, DATA1 as variant
Dim x as integer

<DATA1 - calculated >
For x = 1 to 10
CELL1 = "UI" & x
RS.Edit
RS!CELL1 = Data1 -- Error - What is the proper
syntax?
RS.Update
<Change Data1>
Next x


Smitty
 

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