R
rocco
I have a textbox where user enters a PIN
the sub pin value is tested in the BeforeUpdate event:
Private Sub pin_BeforeUpdate(Cancel As Integer)
If Not (pin.Text Like "*[A-Z]*[A-Z]*[A-Z]*" And pin.Text Like "*#*#*#*")
And Not pin.Text = vbNullString Then
msgtxt = "Il PIN digitato non rispetta il formato previsto." &
vbCrLf & _
"Inserimento annullato."
Call ShowMsg(red, msgtxt)
msgtxt = vbNullString
Cancel = -1
End If
End Sub
This will let me move on other controls if the value for the PIN is in the
right format or if I DELETE all what has been entered in the textbox and
exit, leaving it blank.
Blank...blank? Well, it looks like, but it is not!
I get an error in the AfterUpdate sub thus I have tested the pin.value in
the AfterUpdate procedure with this:
If pin.value = Null Then
MsgBox "NULL"
ElseIf pin.value = "" Then
MsgBox """"""
ElseIf pin.value = vbNullString Then
MsgBox "vbnullstring"
Else
MsgBox "other"
End If
and guess what... I get "other", which is gently pushing me to jump out of
the window.
What is "other" if the textbox is left blank, I mean I selected ALL the text
entered and pressed canc (or delete) ?! Are there ghost values?
rocco
the sub pin value is tested in the BeforeUpdate event:
Private Sub pin_BeforeUpdate(Cancel As Integer)
If Not (pin.Text Like "*[A-Z]*[A-Z]*[A-Z]*" And pin.Text Like "*#*#*#*")
And Not pin.Text = vbNullString Then
msgtxt = "Il PIN digitato non rispetta il formato previsto." &
vbCrLf & _
"Inserimento annullato."
Call ShowMsg(red, msgtxt)
msgtxt = vbNullString
Cancel = -1
End If
End Sub
This will let me move on other controls if the value for the PIN is in the
right format or if I DELETE all what has been entered in the textbox and
exit, leaving it blank.
Blank...blank? Well, it looks like, but it is not!
I get an error in the AfterUpdate sub thus I have tested the pin.value in
the AfterUpdate procedure with this:
If pin.value = Null Then
MsgBox "NULL"
ElseIf pin.value = "" Then
MsgBox """"""
ElseIf pin.value = vbNullString Then
MsgBox "vbnullstring"
Else
MsgBox "other"
End If
and guess what... I get "other", which is gently pushing me to jump out of
the window.
What is "other" if the textbox is left blank, I mean I selected ALL the text
entered and pressed canc (or delete) ?! Are there ghost values?
rocco