D
Daniel
Hello,
I am trying to intercept the space bar key entry in a textbox to insert
special characters.
Private Sub ClientEmail_KeyPress(KeyAscii As Integer)
Dim strEmail As String
'Simplify e-mail address entry using spacebar
If KeyAscii = 32 Then
strEmail = Me.ClientEmail
If InStr(strEmail, "@") = 0 Then
Me.ClientEmail.Value = strEmail & "@"
Else
Me.ClientEmail.Value = strEmail & "."
End If
End If
End Sub
I'm experiencing 2 problems.
1- an error occurs at line 'strEmail = Me.ClientEmail' stating that it is
null even after entering a string value. I can get around this issue by
placing a me.dirty=false before the line, but I still don't understand the
underlying problem as there is a string value in the textbox when the error
is triggered?
2- My real issue, is that after this code runs, the textbox gets blanked?!?!
If I do an undo the proper text appear. Why oh Why is my code blanking the
entry altogether?
Daniel P
I am trying to intercept the space bar key entry in a textbox to insert
special characters.
Private Sub ClientEmail_KeyPress(KeyAscii As Integer)
Dim strEmail As String
'Simplify e-mail address entry using spacebar
If KeyAscii = 32 Then
strEmail = Me.ClientEmail
If InStr(strEmail, "@") = 0 Then
Me.ClientEmail.Value = strEmail & "@"
Else
Me.ClientEmail.Value = strEmail & "."
End If
End If
End Sub
I'm experiencing 2 problems.
1- an error occurs at line 'strEmail = Me.ClientEmail' stating that it is
null even after entering a string value. I can get around this issue by
placing a me.dirty=false before the line, but I still don't understand the
underlying problem as there is a string value in the textbox when the error
is triggered?
2- My real issue, is that after this code runs, the textbox gets blanked?!?!
If I do an undo the proper text appear. Why oh Why is my code blanking the
entry altogether?
Daniel P