Looping through text boxes
Looping through text boxes
(OP)
I want to set the value of unbound text boxes on a form. The form is set up in a grid (Letters x Numbers). I want to loop through a few of the text boxes and place the required value in the correct text box. I thought I could concatenate the letter and number that corresponds to the grid to the base name of the text box.
For example:
Letter=65, Number=5.
strTextBox = "Me!txtCell" & Chr(Letter) & Number
Equals: Me!txtCellA5
Then I'd use strTextBox, and values from a query or table, to fill out the grid with data.
(Am I missing something fundemental about controls and forms?)
Thanks,
Ken
For example:
Letter=65, Number=5.
strTextBox = "Me!txtCell" & Chr(Letter) & Number
Equals: Me!txtCellA5
Then I'd use strTextBox, and values from a query or table, to fill out the grid with data.
(Am I missing something fundemental about controls and forms?)
Thanks,
Ken
RE: Looping through text boxes
You need to refer to the control using this syntax:
Me(strTextBox)
Check out the help topic on Controls Collection to see what I mean.
I hope this helps. Post again if you need more or if I missed your point.
Kathryn
RE: Looping through text boxes
Unfortunately I had a family emergency that required me to miss work, so I was unable to respond to your post.
My problem was relatively simple. I wasn't properly formatting the string variable so that the form could recognize the variable as a control.
This is what I had:
strTextBox = "Me!txtCell" & Chr(Letter) & Number
Set ctlControl = strTextBox
And this is what worked:
strTextBox = "txtPrimer" & Chr(Letter) & Number
Set ctlControl = Me(strTextBox )
What I am trying to do is set up a user interface that displays data captured from an biochemistry instrument that performs experiments in a 16 x 24 grid. The users of the instrument are familiar with looking at the data in this grid format. So, even though it's a pain for me to design a form that looks like a grid, that's what I have to do.
I just can't get these scientist types to think in table, queries, and stepping through recordsets!
RE: Looping through text boxes
The subform, in datasheet view will act like a grid. And also you have a main form to add controls and other things like a Print button
Also you can create macros and put them in a new tool bar at the top. So they can be viewing a table or whatever and still print a report or something.
DougP, MCP
dposton@universal1.com
Ask me how Bar-codes can help you be more productive.
RE: Looping through text boxes
I've now got the form set up to switch between fields for each record and update the cells in the grid.
I'm sure I'll be posting more questions regarding this form.
Thanks,
Ken