I have a FORM that users are supposed to complete. This form contains a
number of text and combo boxes with their respective labels.
Even though I have gone through several examples of code, I cannot seem to
do the following.
Using CreateReportControl I want to cycle through every control on the FORM
and grab the value of each control, create a text box on a REPORT, and also
grab the label name of the control from the form and attach it to the new
REPORT control.
All that seems to happen is a single, empty text box gets created on the
report, with no label.
Here is the obviously crude, ragged and non-working command I try to use.
Dim ctl As Control
Dim rep As Report
Set rep = CreateReport
Dim tmpctl As Control
Dim tmpctl_label As Control
For Each ctl In thisform.Controls
With ctl
Select Case .ControlType
Case acTextBox
If .Enabled = True Then
Set tmpctl = CreateReportControl(rep.Name, acTextBox, acDetail, ctl, , "",
1134, 1134 + (567 * rowcounter))
Set tmpctl_label = CreateReportControl(rep.Name, acLabel, , tmpctl.Name, ,
1134, 1134)
End If
End Select
End With
Next ctl
Please please please can someone tell me how to do this.
Thank you very much.