From the code below I think what I intend to do is obvious. Please explain to me what is wrong and/or how to correct it!
Important: the SQL is working as expected, in the sense that given a StockID, it gets the counting number correctly.
Best regards and thanks a lot, Fábio.
Set objConnection = Server.CreateObject("ADODB.Connection") objConnection.Provider = "etc" objConnection.ConnectionString = "etc"
objConnection.Open
NumberStocks = 2
Dim NumberOfRecords()
For I = 0 To NumberStocks
aux = "SELECT something.StockID, Count(something.SgnQtyShares) AS NumbPositShares FROM something GROUP BY something.StockID HAVING (((something.StockID)=" & I & ") AND ((Count(something.SgnQtyShares))>0));"
Set NumberOfRecords(I) = objConnection.execute(aux)
Next 'I
Obs.: substituting I at the SQL the problem persists (see error message below) therefore it seems to me that the real trouble is related to the NUmberOfRecords() definition or something like that.
Error Message:
Microsoft VBScript runtime (0x800A0009) Subscript out of range
Please don´t mention any delay, alorentz! I am pretty sure you are always very busy with clients/projects and your good-will in helping us in your "leisure/spare time" is really admirable.
Now I see my mistake. I took the "dynamic array" approach too freely...