I have a Recordset obtained by the following query:
SELECT DISTINCT [Number] FROM NUMBERS WHERE CODE = 7 ORDER BY [Number]
The Recordset will therefore be a list of ordered numbers, eg. [6,14,37,59,81,145]
I would like to generate a long string of numbers made up of only 0s and 1s, where it is all 0s except in positions designated by the numbers in the recordset: eg. 6,14,37,59, etc.
The result would therefore look something like:
000000000000000000100000000000000000000001000000000000000000001000000 etc
Assuming that rs is the Recordset, I have the following code so far. Would this work?
intLower = 1
While Not (rs.BOF Or rs.EOF)
intUpper = rs!Number
For intSlot = intLower To intUpper
strOutput = strOutput & IIf(rs!Number = intSlot, 1, 0)
Next intSlot
rs.moveNext
intLower = intUpper + 1
Wend
Note: I realise this is similar to an earlier question of mine, but I am now asking how to do this when the numbers are contained in a Recordset. Also note that I do not want to use a function that converts a recordset to an array, because I am using DAO and apparently the GetRows is problematic.
How about;
Edit as they are sorted;