I'm trying to include a variable in a text box name in my SQL... For example, I have a recordset that I'm looping through and posting values to text boxes tahat are read in my SQL. The name is in the form of '" & Me.txt_TextBoxName_quarter1.value & "'. I would like to include a variable in place of the 1 so that on the first iteration it's = 1, 2nd iteration = 2 etc., etc. I've tried '" & IterationNumber & "' and a few other combinations of ' or " but can't get my SQL to compile.
Thanks for any help.
Not sure to understand precisely what you're looking to achieve. If you want to dynamically address several controls of the form (i.e. "txt_TextBoxName_quarter1", then "txt_TextBoxName_quarter2", etc.), you can compose the name of the control and address it through the Controls collection of the form:
Dim i as Long
Dim strCtlName as String
dim varSomeVariable as Variant
For i = 1 to 4
strCtlName = "txt_TextBoxName_quarter" & i
varSomeVariable = Me.Controls(strCtlName).Value