(Q) I have a bunch of text box controls on form named like txtTextBox1, txtTextBox2,
txtTextBox3 all the way to txtTextBox10. Can I refer to the fields from a single loop
instead of explicitly referencing me!txtTextBox1, me!txtTextBox2 etc.?
(A) With forms and reports, you can reference a control by passing a string to the
object. For example, the following snippet will print out the contents of all these
textboxes to the Debug Window.
Dim i As Integer
For i = 1 To 10
Debug.Print Me("txtTextBox" & i).Value
Next i
|