[thelist] naming variables dynamically

Michael Robertson mike at mikeemedia.com
Wed Jul 31 10:00:01 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
Is it possible to name variables dynamically? I'm stuck.  I'm tryng to loop
through an array doing a sql statement on each item in array and store the
results in a new variable each time. But how would I give it a unique name
each time?

strSQL="select distinct ProgramWeek from tblRecordSteps where userID ='" &
session("userID") & "'"
objRsSOpen strSQL
NumWeeksArray=objRs.GetRows()
objRs.Close

Const intField=0

For intWeeks = 0 to UBound(NumWeeksArray,2)
     strSQL="select avg(Steps) as avgSteps from tblRecordSteps where
ProgamWeek=" & NumWeeksArray       (intField,intWeeks) & " and userID ='" &
session("userID") & "'"
     objRsSOpen strSQL
    Dim newVar
    newVar1=objRs("avgSteps")
    objRs.Close
Next

Maybe there is a better way. Suggestions?

--




More information about the thelist mailing list