Would the value in Analysis::TestID be the value of this field in the layout's current record?
WHERE measurements.testid = ?
ORDER BY Voltage ASC
; "" ; "" ; analysis::testid )
and you probably don't need "anlysis::" but just the field name if your layout is based on the analysis table occurrence.
PhilModJunk you are awesome. That was what it needed. Thank you.