F
Frankie via AccessMonster.com
Can someone please help me with the following code that now produces an error
6 overflow message :
Function JoursOuvres(deb, fin)
Dim db As Database
Dim r As Recordset
Dim jours As Integer
Dim temp
Set db = CurrentDb()
Set r = db.OpenRecordset("tblJoursFeries")
temp = deb
jours = 0
Do While temp <= fin
If (DatePart("w", temp) <> 1) And (DatePart("w", temp) <> 7) Then
jours = jours + 1
End If
temp = DateAdd("d", 1, temp)
Loop
r.MoveFirst
Do While Not r.EOF
If r("JoursFeries") >= deb And r("JoursFeries") <= fin And _
DatePart("w", r("JoursFeries")) <> 7 And _
DatePart("w", r("JoursFeries")) <> 1 Then
jours = jours - 1
End If
r.MoveNext
Loop
r.Close
JoursOuvres = jours
End Function
When I run the debuging tool it focuses on "Jours = Jours + 1 ".
I just don't get it !
Thanks in advance for your response
Frankie
6 overflow message :
Function JoursOuvres(deb, fin)
Dim db As Database
Dim r As Recordset
Dim jours As Integer
Dim temp
Set db = CurrentDb()
Set r = db.OpenRecordset("tblJoursFeries")
temp = deb
jours = 0
Do While temp <= fin
If (DatePart("w", temp) <> 1) And (DatePart("w", temp) <> 7) Then
jours = jours + 1
End If
temp = DateAdd("d", 1, temp)
Loop
r.MoveFirst
Do While Not r.EOF
If r("JoursFeries") >= deb And r("JoursFeries") <= fin And _
DatePart("w", r("JoursFeries")) <> 7 And _
DatePart("w", r("JoursFeries")) <> 1 Then
jours = jours - 1
End If
r.MoveNext
Loop
r.Close
JoursOuvres = jours
End Function
When I run the debuging tool it focuses on "Jours = Jours + 1 ".
I just don't get it !
Thanks in advance for your response
Frankie