C
Chris F via AccessMonster.com
Hello all-
I am using Access 2007, and have a form with a text box that a user is to
enter their User Name in. A check is performed on the After_Update Event of
the text box and if the user name is not found in the BE, an error message is
displayed and the text box is to gain focus and the value entered in the text
box using the SelLength function is to be highlighted, however, it does not
appear to be working properly. Here is the code:
If intCheckName = 0 Then
'Show Error Message
Me.ErrorMessage.Caption = "User does not Exist."
Me.ErrorMessage.Visible = True
Me.LoginPassword.Value = ""
Me.LoginPassword.Enabled = False
Me.btnLogin.Enabled = False
With Me.LoginName
.SetFocus
.SelStart = 0
.SelLength = Len(Me.LoginName.Text)
End With
What appears to be happening is that the text in this field is highlighted
breifly, but then the cursor moves to infront of the text. I also tried Me.
LoginName.SelStart = Len(Me.LoginName.Text) and yet the cursor remains
infront of the text and not at the end of the text as I thought the above
code would produce.
Is there something I am missing here?
Thank you in advance for any help that you all may be.
Regards,
Chris F
I am using Access 2007, and have a form with a text box that a user is to
enter their User Name in. A check is performed on the After_Update Event of
the text box and if the user name is not found in the BE, an error message is
displayed and the text box is to gain focus and the value entered in the text
box using the SelLength function is to be highlighted, however, it does not
appear to be working properly. Here is the code:
If intCheckName = 0 Then
'Show Error Message
Me.ErrorMessage.Caption = "User does not Exist."
Me.ErrorMessage.Visible = True
Me.LoginPassword.Value = ""
Me.LoginPassword.Enabled = False
Me.btnLogin.Enabled = False
With Me.LoginName
.SetFocus
.SelStart = 0
.SelLength = Len(Me.LoginName.Text)
End With
What appears to be happening is that the text in this field is highlighted
breifly, but then the cursor moves to infront of the text. I also tried Me.
LoginName.SelStart = Len(Me.LoginName.Text) and yet the cursor remains
infront of the text and not at the end of the text as I thought the above
code would produce.
Is there something I am missing here?
Thank you in advance for any help that you all may be.
Regards,
Chris F