Hi,
I have a pretty crazy problem when trying to do the following. I have a simple form with several textboxes. I would like to read the textbox value one by one by incrementing the textbox number (say we have 5 textboxes numbered Text1 to Text5. Here is the example of the code:
However, this code gives me an error, because it does not recognizes the variable "i". I tried almost everything: double quotes, simple qoutes around double quotes, etc...but nothing works. Not even substituting a string with the textbox name e.g. String1 = "Text1" in the Readtxt expression.
Anybody has a briliant idea?
Thanks,
Marcin
I have a pretty crazy problem when trying to do the following. I have a simple form with several textboxes. I would like to read the textbox value one by one by incrementing the textbox number (say we have 5 textboxes numbered Text1 to Text5. Here is the example of the code:
Code:
Private Sub Command2_Click()
For i = 1 To 5
Readtxt = [Forms]![Form1]![Text" & i & "]
MsgBox Readtxt
Next i
End Sub
However, this code gives me an error, because it does not recognizes the variable "i". I tried almost everything: double quotes, simple qoutes around double quotes, etc...but nothing works. Not even substituting a string with the textbox name e.g. String1 = "Text1" in the Readtxt expression.
Anybody has a briliant idea?
Thanks,
Marcin