Problème de typage de variable : incompatibilité de type
Bonjour j'ai la fonction suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Function get_operation_suivante(ByVal op As Integer, cnn As ADODB.connection) As Variant
Dim rst As New ADODB.Recordset
Dim requetteSQL As String
requetteSQL = "SELECT numOperation FROM operation WHERE numOperation > " & op _
& " ORDER BY numOperation;"
Debug.Print requetteSQL
rst.Open requetteSQL, cnn
Dim operation As Variant
Dim i As Integer
For i = 1 To rst.RecordCount
operation(i) = rst.Fields("numOperation")
Next i
rst.Close
get_operation_suivante = operation(1)
End Function |
Mais j'obtiens une 'incompatibilité de type' à la ligne :
Code:
get_operation_suivante = operation(1)
Pourquoi mon type n'est pas valable svp ? J'ai essayé avec as integer en valeur de retour, mais cela ne fonctionne pas non plus.
une idée svp ?
Merci ! :)