Type incompatible: 'Ubound' ?
Bonjour,
ce doit être tout bête mais bon
Voila j'ai une fonction qui interroge une bdd ci-dssous code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Function tester_annee()
Dim sql,rst,i,resultat()
sql = "SELECT Annee FROM TNotesRMS WHERE CodeRMS= " & (session("code_rms"))
Set rst=Application("cnx").Execute(sql)
i=0
Do while rst.EOF=False
Redim Preserve resultat(i)
resultat(i)=rst("Annee")
i=i+1
rst.MoveNext()
Loop
rst.Close()
tester_annee=resultat
End function |
puis ailleurs j'interroge ma fonction comme suit
Code:
1 2 3 4
| test_annee=tester_annee()
For i=1 to Ubound(test_annee,1)
compteur=i
next |
mon problème : comment intercepter le fait qu'il peut ne pas avoir d'enregistrement ds ma bdd?
car qd j'ai 1 ou + d'enregistrement nickel, qd j'en ai pas
Type imcompatible : 'UBound '
merci bcp
Embêtant si gestion d'exception globale / d'appelant
Embêtant si gestion d'exception globale / d'appelant ...
J'ai trouvé ça qui est assez pratique pour mon cas :
If (Join(tableau, "") = "" Then ...
Citation:
Envoyé par
DarkVader
en testant test_année
par exemple
Code:
1 2 3 4 5 6 7 8
| Function arrayEmpty(varTest)
On Error Resume Next
Dim a As Long
a = UBound(varTest)
arrayEmpty = CBool(a = 0)
End Function |