
08-10-2004, 08:12 PM
|
|
Centurion
|
|
Join Date: Jun 2001
Posts: 128
|
|
Hi,
Seems to work but if you have something like this,
it does not padd the leading zeros.
TmpStr = Split("786A/2004", "/")
its becomes 0786/2004
should be 0786A/2004
good job. make life easier.
thanks a bunch
Quote:
|
Originally Posted by b0b
im sure there's a better way but this works
Code:
Dim TmpStr() As String
TmpStr = Split("786/2004", "/")
TmpStr(0) = Format$(TmpStr(0), "00000")
If Len(TmpStr(1)) < 4 Then 'if they've enter full year dont bother formatting
If TmpStr(1) >= 0 And TmpStr(1) < 90 Then 'checks year
TmpStr(0) = TmpStr(0) & "/" & Format$(TmpStr(1), "2000")
Else
TmpStr(0) = TmpStr(0) & "/" & Format$(TmpStr(1), "1900")
End If
Else
TmpStr(0) = TmpStr(0) & "/" & TmpStr(1)
End If
MsgBox TmpStr(0)
|
|
|