dynamictiger
Registered User.
- Local time
- Today, 03:24
- Joined
- Feb 3, 2002
- Messages
- 270
I have an unbound report that is populated entirely by code. I have this working but was playing around optimising it to cut the redundant loops out of the code and making it a bit more efficent, for slower machines.
The report is structured like:
lbl1 txt1 lblO1 tt1
lbl2 txt2 lblO2 tt2
through to 8 rows of each. lbl1 and lblO1 and tt1 are all labels, txt1 is a text field.
These names are the same as the forms that feed the information in, again the forms don't know what they are recording and the only limit is 8.
I have following code in the report that is populating lbl1 and txt1 but fails to even find lblO1, I don't understand why.
Function dpsDecideReportLabel(frm As Form, objRpt As clsWaterReportDriver)
'This module loops the report throwing down as required
'We are targeting a reduced loop count
Dim ctlRpt As Control
For Each ctlRpt In Me.Report
If Not ctlRpt.Tag = "Not" Then
MsgBox "RPTWaterTest.dpsDecideReportLabel " & ctlRpt.Name
'Debug Code added for Testing Only
Select Case Left(Right(ctlRpt.Name, 2), 1)
Case "O"
MsgBox "Yahoo " & ctlRpt.Name
Case "T"
MsgBox "Text Result"
Case "l"
MsgBox "Label " & ctlRpt.Name
Case "t"
MsgBox "TestResult " & ctlRpt.Name
End Select
'End DebugCode
Call dpsReportLabel(frm, ctlRpt, objRpt)
End If
mintLoop = mintLoop + 1
Next
End Function
The report is structured like:
lbl1 txt1 lblO1 tt1
lbl2 txt2 lblO2 tt2
through to 8 rows of each. lbl1 and lblO1 and tt1 are all labels, txt1 is a text field.
These names are the same as the forms that feed the information in, again the forms don't know what they are recording and the only limit is 8.
I have following code in the report that is populating lbl1 and txt1 but fails to even find lblO1, I don't understand why.
Function dpsDecideReportLabel(frm As Form, objRpt As clsWaterReportDriver)
'This module loops the report throwing down as required
'We are targeting a reduced loop count
Dim ctlRpt As Control
For Each ctlRpt In Me.Report
If Not ctlRpt.Tag = "Not" Then
MsgBox "RPTWaterTest.dpsDecideReportLabel " & ctlRpt.Name
'Debug Code added for Testing Only
Select Case Left(Right(ctlRpt.Name, 2), 1)
Case "O"
MsgBox "Yahoo " & ctlRpt.Name
Case "T"
MsgBox "Text Result"
Case "l"
MsgBox "Label " & ctlRpt.Name
Case "t"
MsgBox "TestResult " & ctlRpt.Name
End Select
'End DebugCode
Call dpsReportLabel(frm, ctlRpt, objRpt)
End If
mintLoop = mintLoop + 1
Next
End Function