speed up to select distinct
I use the tipical ado connection and VB& to set an Access MDB.
Code:
Public Sub CHECK_CONNESSIONE()
ENVIOR = ""
ENVIOR = VBA.Environ("COMPUTERNAME")
If CONN Is Nothing Then
If ENVIOR = "SS-72D68331754B" Or ENVIOR = "MY-F554C8E61153" Then
Set CONN = New ADODB.Connection
With CONN
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ASS_MF\DATABASE\BA.mdb;Persist Security Info=False"
.CommandTimeout = 0
.CursorLocation = adUseClient
.Open
End With
Else
Set CONN = New ADODB.Connection
With CONN
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\1234567\345677$\FSRM107\Ge_O\DATABASE\BA.mdb;Persist Security Info=False"
.CommandTimeout = 0
.CursorLocation = adUseClient
.Open
End With
End If
End If
End Sub
Into table1 are approx 180.000
into table are a filed named DATES (is just indexed, dupes YES)
i open the recordset of DATES (as date short) with to select distinct dates:
Code:
Dim objCommand As ADODB.Command
Set objCommand = New ADODB.Command
With objCommand
.ActiveConnection = CONN
.CommandText = "SP"
.CommandType = adCmdStoredProc
Set RS = .Execute
Set objCommand = Nothing
End With
SP query:
Code:
SELECT TOT.DATA_OPE, TOT.SP_MF
FROM TOT_ASSEGNI
GROUP BY TOT.DATA_OPE, TOT.SP_MF
HAVING (([TOT].[SP_MF]="SP"));
possible the time to return recordset is approx 5 minutes??????????????????????????'