Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through text boxes

Status
Not open for further replies.

KenG

Technical User
Mar 20, 2000
67
0
0
US
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
 
Your basic concept sounds OK, although why you're doing what you're doing escapes me. Could you post the code snippet where you actually used strTextBox, and tell us what the problem was with what you tried? Or didn't you get that far?

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


 
Thank you for your reply.
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! :)
 
I guess you know you can add a subform on a main form.
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.
 
Unfortunately each cell in this grid is actually a unique record in the underlying table. In other words; depending on what the user wants to see, the value in each cell is actually one field for each of the 384 records that are viewed concurrently.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top