Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USE find instead to loop

Status
Not open for further replies.

2009luca

Programmer
Jul 27, 2013
222
IT
i create an array with:

'PR_ISTAT
SQL = "SELECT PR, PROVINCIA, COUNT(ISTATEXT) AS NUM FROM (SELECT DISTINCT PR, PROVINCIA, ISTATEXT FROM COMUNI_ISTAT) GROUP BY PR, PROVINCIA"
Set RST = New ADODB.Recordset
RST.CursorLocation = adUseClient
RST.Open SQL, CON, adOpenForwardOnly, adLockReadOnly

Erase ARRAY_PR_ISTAT()
ARRAY_PR_ISTAT = RST.GetRows(RST.RecordCount)
RST.Close
Set RST = Nothing

actually loop all value in array to get the NUM value based a IF PR="AT"

I think this is a bidimensional array and the find clausole i can use only on a monodimensional array...

dubt
 
I'v e said it before, and I'll say it again.

You keep using recordsets to populate VB structures and controls. And then want to perform fairly typical data filtering operations to access a subset of the data. Operations that could much more easily be carried out with the underlying recordset itself.

 
How about (along strongm's suggestion):

Code:
...
RST.Open SQL, CON, adOpenForwardOnly, adLockReadOnly[blue]
RST.Filter = "[highlight #FCE94F]PR = 'AT'[/highlight]"[/blue]
...

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top