1 2 3 4 5 6 7 8 9 10 11 12 13
| Function NextDev()
Dim X as long, crit as String, StrSQL As String
X=Nz(DCount("DEVUnik", "tblDevis"),0)
If X=0 then 'Ici je tiens compte du cas où la table est vide
NextDev= Format(Now,"yyyy") & "-" & "0001"
Else
crit = "clng(right(year(DEVDte),2))=" & CLng(Right(Year(Now), 2))
StrSQL = "SELECT CLng(Left([DEVNo],2)) AS lAn, CLng(Right([DEVNo],4)) AS Num FROM tblDevis WHERE " & crit & ";"
Call CreeRequeteTempo(StrSQL)
NextDEV = Right(Trim(str(Year(Now()))), 2) & "-" & Format(Nz(DCount("Num", "RequTempo"), 0) + 1, "0000")
End If
End Function |
Partager