Code verkürzen
29.10.2015 16:44:05
PQuest:-)
wie könnte man diesen Code
...
For lngIndex = 1 To 17
With Controls("TextBox" & CStr(lngIndex))
If lngIndex = 17 And (.Value) = "" Then
Call MsgBox("Date of birth is required.", vbExclamation, "Date Required")
Call .SetFocus
.Text = vbNullString
blnWrongEntry = True
Exit For
ElseIf Not IsDate(.Value) And Not .Text = "" Then
Call MsgBox("Field ''" & .Tag & "'' do not contain a correct dateformat.", vbExclamation, "Hinweis")
Call .SetFocus
.Text = vbNullString
blnWrongEntry = True
Exit For
End If
End With
Next
...
so umstellen, dass man den Teil
Call .SetFocus
.Text = vbNullString
blnWrongEntry = True
Exit For
nur einmal schreiben muss?