AW: welche Textbox ist das? owT
31.08.2018 13:59:09
Peter
Hallo Robert,
ich habe den Code wie folgt geändert.
Funktioniert einwandfrei.
Private Sub TextBox2_Change()
If TextBox2.Tag = "1" = True Then Exit Sub
If Len(TextBox2) = 2 Then
If InStr(TextBox2, ".") = 0 Then TextBox2 = TextBox2 & "."
ElseIf Len(TextBox2) = 5 Then
If Len(TextBox2) - Len(Application.Substitute(TextBox2, ".", ""))
Private Sub TextBox2_AfterUpdate()
TextBox2.Tag = 1
If Right(TextBox2, 1) = "." Then TextBox2 = Mid(TextBox2, 1, Len(TextBox2) - 1)
' Jahreszahl vom aktuellen Jahr ergänzen falls nicht vorhanden
If Len(TextBox2) - Len(Application.Substitute(TextBox2, ".", "")) = 1 Then
TextBox2 = TextBox2 & "." & Year(Date)
End If
If IsDate(TextBox2.Text) Then
If Format(CDate(TextBox2.Value), "dd.mm.yyyy") TextBox2 Then
MsgBox "Das Datum wurde übersetzt"
End If
TextBox2 = Format(CDate(TextBox2.Value), "dd.mm.yyyy")
Else
TextBox2 = ""
End If
TextBox2.Tag = ""
End Sub
Es sollte nur noch eingebaut werden, dass nach der vierten Jahreszahl Schluss ist mit der Eingabe.
Kannst Du mir hierbei bitte helfen.
Gruss
Peter