Adition heure état

Résolu
cs_peter2010 Messages postés 48 Date d'inscription vendredi 25 septembre 2009 Statut Membre Dernière intervention 29 juillet 2010 - 26 juil. 2010 à 16:20
cs_peter2010 Messages postés 48 Date d'inscription vendredi 25 septembre 2009 Statut Membre Dernière intervention 29 juillet 2010 - 27 juil. 2010 à 19:59
Bonjour, je dois créer un état spécifique à chacun des employés, pour chacune des activités réalisées, le nombre d'heures au total, le nombre de documents au total, le tout en fonction du meme nom d'activité, de tache, de code d'abscence et du type de temps. J'ai donc procédé à la création de ma requete mais lorsque j'additionne les heures (de type date) access me renvoie des nombres impossibles... J'ai cherché partout sur le net et je n'ai pas trouvé, voici ma requete :

SELECT DetailJRT.noAct, Sum(aditionTotaux(CDate([nbHrs]))) AS Total, DetailJRT.noTache, Sum(DetailJRT.nbDoc) AS SommeDenbDoc, DetailJRT.codeAbs
FROM Employe INNER JOIN ((RepartTemps INNER JOIN JourRT ON RepartTemps.noSeqRt JourRT.noSeqRT) INNER JOIN DetailJRT ON JourRT.noSeqJRT DetailJRT.noSeqJRT) ON Employe.codeUsager = RepartTemps.codeUsager
WHERE (((RepartTemps.codeUsager)=[Forms]![FrmRapEmpl]![lstEmplRap]) AND ((RepartTemps.typeTemps)=[Forms]![FrmRapEmpl]![lstTypeTempsRap]) AND ((JourRT.dateJour) Between [Forms]![FrmRapEmpl]![txtDateDep] And [Forms]![FrmRapEmpl]![txtDateFin]))
GROUP BY DetailJRT.noAct, DetailJRT.noTache, DetailJRT.codeAbs;

voici une fonction crée pour calculer les heures


Public Function aditionTotaux(tot1 As String, Optional tot2 As String 0, Optional tot3 As String 0, Optional tot4 As String = 0, Optional tot5 As String = 0, Optional tot6 As String = 0, Optional tot7 As String = 0)
If Not IsNull(tot1) Then
tot1 = Format(tot1, "hh:mm")
End If
If Not IsNull(tot2) Then
tot2 = Format(tot2, "hh:mm")
End If
If Not IsNull(tot3) Then
tot3 = Format(tot3, "hh:mm")
End If
If Not IsNull(tot4) Then
tot4 = Format(tot4, "hh:mm")
End If
If Not IsNull(tot5) Then
tot5 = Format(tot5, "hh:mm")
End If
If Not IsNull(tot6) Then
tot6 = Format(tot6, "hh:mm")
End If
If Not IsNull(tot7) Then
tot7 = Format(tot7, "hh:mm")
End If

Dim totalhres As Long
Dim totalmins As Long
Dim tot1str() As String
Dim tot2str() As String
Dim tot3str() As String
Dim tot4str() As String
Dim tot5str() As String
Dim tot6str() As String
Dim tot7str() As String



If Not IsNull(tot1) Then
tot1str = Split(tot1, ":")
End If
If Not IsNull(tot2) Then
tot2str = Split(tot2, ":")
End If
If Not IsNull(tot3) Then
tot3str = Split(tot3, ":")
End If
If Not IsNull(tot4) Then
tot4str = Split(tot4, ":")
End If
If Not IsNull(tot5) Then
tot5str = Split(tot5, ":")
End If
If Not IsNull(tot6) Then
tot6str = Split(tot6, ":")
End If
If Not IsNull(tot7) Then
tot7str = Split(tot7, ":")
End If




totalhres = CLng(tot1str(0)) + CLng(tot2str(0)) + CLng(tot3str(0)) + CLng(tot4str(0)) + CLng(tot5str(0)) + CLng(tot6str(0)) + CLng(tot7str(0))
totalmins = CLng(tot1str(1)) + CLng(tot2str(1)) + CLng(tot3str(1)) + CLng(tot4str(1)) + CLng(tot5str(1)) + CLng(tot6str(1)) + CLng(tot7str(1))
If totalmins > 59 Then
totalhres = totalhres + 1
totalmins = totalmins - 60
End If

aditionTotaux = totalhres & ":" & Format(totalmins, "00")
End Function


merci pour votre aide!

1 réponse

cs_peter2010 Messages postés 48 Date d'inscription vendredi 25 septembre 2009 Statut Membre Dernière intervention 29 juillet 2010
27 juil. 2010 à 19:59
résolu par moi-même...
3
Rejoignez-nous