Have an open record set with 40 rows of data in two columns. The column (0) Is Location ID and is Text. The second (1) is Sumof Balls. Using the following code to populate a form with 40 Labels and 40 textboxes:
'Send query to SQL Server
rsdbpen GetBalls
'Loop through Controls
rsdbo.MoveFirst
For Each ctl In Me.Controls
If (ctl.ControlType = acLabel) Then
ctl.Caption = rsdbo.Fields(0)
End If
If (ctl.ControlType = acTextBox) Then
ctl.Value = rsdbo.Fields(1)
rsdbo.MoveNext
End If
Next ctl
The problem is the first and second times through the loop the code doesn't recognize the first "If (ctl.ControlType = acLabel) Then"
Then it does but puts the label in the first position not the third. All the Textbox data is ok.
Have no clue.
Thanks
jpl
'Send query to SQL Server
rsdbpen GetBalls
'Loop through Controls
rsdbo.MoveFirst
For Each ctl In Me.Controls
If (ctl.ControlType = acLabel) Then
ctl.Caption = rsdbo.Fields(0)
End If
If (ctl.ControlType = acTextBox) Then
ctl.Value = rsdbo.Fields(1)
rsdbo.MoveNext
End If
Next ctl
The problem is the first and second times through the loop the code doesn't recognize the first "If (ctl.ControlType = acLabel) Then"
Then it does but puts the label in the first position not the third. All the Textbox data is ok.
Have no clue.
Thanks
jpl