How can I change a textbox control source with vba based on a concate formula?
I have a database that loops through user defined criteria and exports to excel. The user can fill in up to 100 different textboxes, but rather than assign a different query to each text box, I'd rather use 1 hidden text box that pivots through each textbox. Can anyone see the error in my code below. I feel its something simple but I cant place my finger on it.
Thanks
Private Sub Command2_Click()
ct = 1
Do Until ct = 101
Me.tbloop.ControlSource = """=[Forms]![fTop]![tb" & Format(ct, "000") & "]"""
Me.tbLoopName.ControlSource = """=[Forms]![fTop]![tb" & Format(ct, "000") & "Name]"""
MsgBox ct
MsgBox Me.tbloop.ControlSource
Call ExporttoExcel
ct = ct + 1
Loop
End Sub