Hello,
I would like to have of the assistance on this function. This function calculate the bank holiday between two dates. When I insert this line in my query and that I wish to launch my query it posts me a window by indicating to me that it awaits a data to continue and I would like to know why?.
I call like this my function
essay:CompteJoursFeriés([tblJoursFériés];[DateJourFérié];[Date_Start];[Date_End])
Here my function
Function CompteJoursFeriés(rst As Recordset, strDateFérié As String, _
dhDébut As Date, dhFin As Date) As Integer
Dim rstNew As Recordset
Dim strFiltre As String
Dim strAncienFiltre As String
Dim intEnregistrements As Integer
Dim strSQL As String
On Error GoTo TraitementErreur
Set db = CurrentDb()
Set r = db.OpenRecordset("Jours chômés")
If Not rst Is Nothing Then
If Len(strDateFérié) > 0 Then
If Left(strDateFérié, 1) <> "[" Then
strDateFérié = "[" & strDateFérié & "]"
End If
strFiltre = strDateFérié & " BETWEEN #" & dhDébut & "# AND #" & dhFin & "#"
strAncienFiltre = rst.Filter
rst.Filter = strFiltre
Set rstNew = rst.OpenRecordset()
If rstNew.RecordCount > 0 Then
rstNew.MoveLast
intEnregistrements = rstNew.RecordCount
End If
' Pour ne pas compter à double un jour férié tombant sur un weekend
rstNew.MoveFirst
Do While Not rstNew.EOF
If EstWeekend(rstNew!DateJourFérié) Then
intEnregistrements = intEnregistrements - 1
End If
rstNew.MoveNext
Loop
rstNew.Close
End If
End If
TraitementFinal:
CompteJoursFeriés = intEnregistrements
Exit Function
TraitementErreur:
Resume TraitementFinal
End Function
Thanks for your help
Nilses
I would like to have of the assistance on this function. This function calculate the bank holiday between two dates. When I insert this line in my query and that I wish to launch my query it posts me a window by indicating to me that it awaits a data to continue and I would like to know why?.
I call like this my function
essay:CompteJoursFeriés([tblJoursFériés];[DateJourFérié];[Date_Start];[Date_End])
Here my function
Function CompteJoursFeriés(rst As Recordset, strDateFérié As String, _
dhDébut As Date, dhFin As Date) As Integer
Dim rstNew As Recordset
Dim strFiltre As String
Dim strAncienFiltre As String
Dim intEnregistrements As Integer
Dim strSQL As String
On Error GoTo TraitementErreur
Set db = CurrentDb()
Set r = db.OpenRecordset("Jours chômés")
If Not rst Is Nothing Then
If Len(strDateFérié) > 0 Then
If Left(strDateFérié, 1) <> "[" Then
strDateFérié = "[" & strDateFérié & "]"
End If
strFiltre = strDateFérié & " BETWEEN #" & dhDébut & "# AND #" & dhFin & "#"
strAncienFiltre = rst.Filter
rst.Filter = strFiltre
Set rstNew = rst.OpenRecordset()
If rstNew.RecordCount > 0 Then
rstNew.MoveLast
intEnregistrements = rstNew.RecordCount
End If
' Pour ne pas compter à double un jour férié tombant sur un weekend
rstNew.MoveFirst
Do While Not rstNew.EOF
If EstWeekend(rstNew!DateJourFérié) Then
intEnregistrements = intEnregistrements - 1
End If
rstNew.MoveNext
Loop
rstNew.Close
End If
End If
TraitementFinal:
CompteJoursFeriés = intEnregistrements
Exit Function
TraitementErreur:
Resume TraitementFinal
End Function
Thanks for your help
Nilses