Hello,
My problem was completely badly written.
In fact I have a field LaDate with the data
1- May 01st
1 - May 02nd
1 - May 03rd
(1 - May 04th Saturday, ) - Don't appear in the DB
(1 - May 05th Sunday, ) - Don't appear in the DB
1 - May 06th
1 - May 07th
1 - May 18th
2 - May 03rd
(Weekend 4 & 5/5)
2 - May 06th
2 - May 07th
2 - Jun 01st
As result I would like to have:
1 - May 01st - May 07th 5 day
1 - May 18th - May 18th 1 days
2 - May 03rd - May 07th 3 days
2 - Jun 01st - Jun 01st 1 day
I've written this code by i can't include the WE.
Code:
Public Function nbJ(nP As Long, d1 As Date)
Dim n As Long, sSQL As String
n = 0
While True
n = n - 1
sSQL = "NR_WKN = " & nP & " And PERIODE = #" & Format(DateAdd("d", n, d1), "yyyy-mm-dd") & "#"
'Debug.Print sSQL,
'Debug.Print Nz(DCount("*", "Maladies", sSQL))
If Nz(DCount("*", "Maladies", sSQL)) = 0 Then
nbJ = n
Exit Function
End If
Wend
End Function