Bonjour,

Dans un sous-formulaire, je fais appel à une fonction pour calculer le total de toutes les lignes
Quand je supprime une ligne de mon sous-formulaire, la fonction, que j'appelle sur l'événement après suppression de mon sous-formulaire me renvoie une erreur
Voici la fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Public Function pFctTotal(Ref As String) As Single
    Dim dbmadb As DAO.Database
    Set dbmadb = CurrentDb
    Dim RecGraux As DAO.Recordset
    Dim StrSql As String
    StrSql = "SELECT TblGrauxDet.edref, Sum(TblGrauxDet.edprixnet) AS SommeDeedprixnet FROM TblGrauxDet GROUP BY TblGrauxDet.edref HAVING TblGrauxDet.edref=" & Chr(34) & Ref & Chr(34)
    Set RecGraux = dbmadb.OpenRecordset(StrSql)
    'MsgBox StrSql
     If RecGraux.EOF Then
        pFctTotal = 0
     Else
        pFctTotal = RecGraux!sommedeedprixnet
    End If
    RecGraux.Close
    Set RecGraux = Nothing
    Set dbmadb = Nothing
End Function
Merci pour votre aide