title image


Smiley 0 Jahre 5 Monate 00 Tage - Das kann man unterbinden
Und zwar so:

Public Function YMDgone(argdate As Date)

Dim Ygone As Integer, Mgone As Byte, Dgone As Byte

If IsNull(argdate) Or argdate > Date Then Exit Function

Ygone = DateDiff("yyyy", argdate, Date) + Int(Format(Date, "mmdd") < Format(argdate, "mmdd"))

Mgone = Int((DateDiff("m", argdate, Date) + Int(Format(Date, "dd") < Format(argdate, "dd")))) Mod 12

If Day(argdate) <= Day(Date) Then

Dgone = Format(Date, "dd") - Format(argdate, "dd")

Else

Dgone = Day(DateSerial(Year(argdate), Month(argdate) + 1, 0)) - Day(argdate) + Day(Date)

End If

'Blendet Jahre/Monate/Tage aus, wenn 0:

YMDgone = IIf(Ygone = 0, "", Ygone & " Jahr" & IIf(Ygone = 1, " ", "e ")) _

& IIf(Mgone = 0, "", Mgone & " Monat" & IIf(Mgone = 1, " ", "e ")) _

& IIf(Dgone = 0, "", Dgone & " Tag" & IIf(Dgone = 1, " ", "e"))

End Function
Gruss aus dem (wilden) Süden ;-) Karl-Heinz

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: