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 26 27
|
Public Function xRetrieve(Optional ByVal whatparam As String = vbNullString, _
Optional ByVal Mois As Integer = 0)
Dim rec As New ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT countparam AS COMPTE_PARAM " & _
"FROM [QueryEtat] WHERE 1=1 "
If Len(whatparam) > 0 Then
strSQL = strSQL & " and ([what] = '" & whatparam & "')"
End If
If Mois > 0 Then
strSQL = strSQL & " And ([moisparamG] = " & Mois & ");"
End If
Dim rst As New ADODB.Recordset
rst.Open strSQL, cnx 'en pas à pas, ça s'arrete ici, rien ne se passe, meme pas un message d'erreur
On Error GoTo errH01
rst.MoveFirst
xRetrieve = CDbl(rst("COMPTE_PARAM"))
rst.Close
Set rst = Nothing
Exit Function
errH01:
Err.Clear
xRetrieve = 0
rst.Close
Set rst = Nothing
End Function |
Partager