V
ViViC
Hi all,
I have a problem with userform textbox formatting. The end result of data
entry is to be shown as 01/01234 or BH/014567 the first two characters is a
claim year (can be 01 for 2001etc or BH for really old claim prefix) and the
last 5 numbers are a file number (always 5 numbers).
Presently the code below allows only numbers for all entries. Another problem
is If I enter 01234 it will display as 00/01234, it should display as
01/00234.
Code to date as follows
Private Sub txtInvClaim_AfterUpdate()
With Me.txtInvClaim
.Value = Format(.Value, "00/00000")
End With
End Sub
Private Sub txtInvClaim_KeyPress(ByVal keyascii As MSForms.ReturnInteger)
Dim OKChar As Boolean
OKChar = True
If Len(Me.txtInvClaim.Value) >= 7 Then
OKChar = False
Else
Select Case keyascii
Case Asc("0") To Asc("9")
'ok
Case Else
OKChar = False
End Select
End If
If OKChar = False Then
keyascii = 0
'Beep
End If
End Sub
Any help will be greatly appreciated and many thaxs to all
ViViC
I have a problem with userform textbox formatting. The end result of data
entry is to be shown as 01/01234 or BH/014567 the first two characters is a
claim year (can be 01 for 2001etc or BH for really old claim prefix) and the
last 5 numbers are a file number (always 5 numbers).
Presently the code below allows only numbers for all entries. Another problem
is If I enter 01234 it will display as 00/01234, it should display as
01/00234.
Code to date as follows
Private Sub txtInvClaim_AfterUpdate()
With Me.txtInvClaim
.Value = Format(.Value, "00/00000")
End With
End Sub
Private Sub txtInvClaim_KeyPress(ByVal keyascii As MSForms.ReturnInteger)
Dim OKChar As Boolean
OKChar = True
If Len(Me.txtInvClaim.Value) >= 7 Then
OKChar = False
Else
Select Case keyascii
Case Asc("0") To Asc("9")
'ok
Case Else
OKChar = False
End Select
End If
If OKChar = False Then
keyascii = 0
'Beep
End If
End Sub
Any help will be greatly appreciated and many thaxs to all
ViViC