dynamictiger
Technical User
This is difficult to explain so bear with me. I have a report that is populated via code with a series of unknown values (unknown to me at development time).
Each of these values is measured against another value being the target value. So far so good.
If the unknown value is outside the target value then we need to add some unknown instruction. This much I can get done.
However, the order of instruction is not necessarily the order of comparison. This is where I am stuck.
So how does it work?
I have set up some loops in the report code to walk through the unkown values and compare them to the target range. If they fail, the value of the failing Unknown is passed as an ID to a recordset that searches a query and finds the appropriate instruction (assuming there is one).
This is then added to a recordset array. In the following manner:
However, it fails to be sorted in any order when I test print as below:
Does anyone know how to force the array to print in the order specified?
Each of these values is measured against another value being the target value. So far so good.
If the unknown value is outside the target value then we need to add some unknown instruction. This much I can get done.
However, the order of instruction is not necessarily the order of comparison. This is where I am stuck.
So how does it work?
I have set up some loops in the report code to walk through the unkown values and compare them to the target range. If they fail, the value of the failing Unknown is passed as an ID to a recordset that searches a query and finds the appropriate instruction (assuming there is one).
This is then added to a recordset array. In the following manner:
Code:
'Set up the array as we have not been here before
If intFirst = 0 Then
Set rstArray = New ADODB.Recordset
'Append fields to the array for later access
rstArray.Fields.Append "TreatOrder", adInteger
rstArray.Fields.Append "Introduction", adVarChar, 250
rstArray.Fields.Append "ChemicalName", adVarChar, 250
rstArray.Fields.Append "Conclusion", adVarChar, 250
rstArray.Index = "TreatOrder"
rstArray.Sort = "TreatOrder DESC"
intFirst = 1
End If
However, it fails to be sorted in any order when I test print as below:
Code:
'Testing onlyxxxxxxxxxxxxxxxxxxxxxxx
'commented out tried earlier rstArray.Sort = "TreatOrder Desc"
Debug.Print rstArray.Fields("TreatOrder") & " " & rstArray.Fields("Introduction") & rstArray.Fields("Conclusion")
rstArray.MoveFirst
Do Until rstArray.EOF
strHolddps = rstArray.Fields("TreatOrder") & " " & rstArray.Fields("Introduction") & rstArray.Fields("Conclusion")
Debug.Print strHolddps
Call dpsPopulatePrint
strHolddps = ""
rstArray.MoveNext
Loop
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Does anyone know how to force the array to print in the order specified?