R
riccifs
Hi to everyone,
on the KeyDown Event of my form I have that:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then
Screen.ActiveControl.Text =
mixed_case(Screen.ActiveControl.Text)
End If
End Sub
And on the BeforeUpdate Event I insert that:
Private Sub txtPhone_BeforeUpdate(Cancel As Integer)
If Not rgxValidate(Me.ActiveControl.Text, "\(\d{3}\) \d{3}-\d{4}")
Then
MsgBox "I don't like " & Me.ActiveControl.Text & "."
Cancel = True
End If
End Sub
I got both mixed_case and rgxValidate to this web-site http://www.mvps.org/access/.
The problems is:
when I rich the txtPhone and hit the tab, after validated the message
box, the code stops itself.
I'm not very good to VBA coding but I think the problem is the
Cancel=True that stops the KeyDown event
How can I modify all that to make it works together? I need both
rgxValidate and mixed_case functions.
I will really appreciate everyone who would help me!
Bye,
Stefano.
on the KeyDown Event of my form I have that:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then
Screen.ActiveControl.Text =
mixed_case(Screen.ActiveControl.Text)
End If
End Sub
And on the BeforeUpdate Event I insert that:
Private Sub txtPhone_BeforeUpdate(Cancel As Integer)
If Not rgxValidate(Me.ActiveControl.Text, "\(\d{3}\) \d{3}-\d{4}")
Then
MsgBox "I don't like " & Me.ActiveControl.Text & "."
Cancel = True
End If
End Sub
I got both mixed_case and rgxValidate to this web-site http://www.mvps.org/access/.
The problems is:
when I rich the txtPhone and hit the tab, after validated the message
box, the code stops itself.
I'm not very good to VBA coding but I think the problem is the
Cancel=True that stops the KeyDown event
How can I modify all that to make it works together? I need both
rgxValidate and mixed_case functions.
I will really appreciate everyone who would help me!
Bye,
Stefano.