strSQL = ""
strSQL = strSQL & "select cote.indice indiceZ, "
strSQL = strSQL & " cote.cote_actuelle coteZ"
strSQL = strSQL & " from t_detail_vin pr, "
strSQL = strSQL & " type_vin vin, "
strSQL = strSQL & " (select ind.id_tvin, "
strSQL = strSQL & " ind.milesime millesime, "
strSQL = strSQL & " c.cote cote_actuelle, "
strSQL = strSQL & " ind.id_indice indice "
strSQL = strSQL & " from t_indices ind, "
strSQL = strSQL & " cote_annuelle c "
strSQL = strSQL & " where ind.id_indice = c.id_indice"
strSQL = strSQL & " and ind.format in('Bouteille') "
strSQL = strSQL & " and c.annee='2010' "
strSQL = strSQL & " and ind.id_indice not in ('1','2','3') "
strSQL = strSQL & " and ind.id_indice < '100') cote "
strSQL = strSQL & " where vin.id_tvin = pr.id_tvin "
strSQL = strSQL & " and pr.milesime = cote.millesime "
strSQL = strSQL & " and vin.id_tvin=cote.id_tvin "
strSQL = strSQL & " and vin.proprietaire not in ('Indifferent') "
strSQL = strSQL & " and vin.proprietaire is not null "
strSQL = strSQL & " order by cote.indice"
rs.Open strSQL, cN, adOpenForwardOnly, adLockOptimistic
If rs.RecordCount > 0 Then
j = 1
i = 0
Do While Not rs.EOF And Not rs.BOF
i = i + 1
Feuil1.Cells(i, j) = rs("coteZ")
Feuil1.Cells(i, j + 1) = rs("coteZ")
rs.MoveNext