Select value in control

  • Thread starter Thread starter John Barnes
  • Start date Start date
J

John Barnes

I have a message box which displays a warning for user to
verify date that appears to be incorrect. I used
Me.ControlName.SetFocus in AfterUpdate code. This takes
the user back to the control.

My question is, how do I automatically highlight the
entire value for easy editing. I want the control to be
highlighted as if the user had tabbed into it.

Thanks.
 
John Barnes said:
I have a message box which displays a warning for user to
verify date that appears to be incorrect. I used
Me.ControlName.SetFocus in AfterUpdate code. This takes
the user back to the control.

My question is, how do I automatically highlight the
entire value for easy editing. I want the control to be
highlighted as if the user had tabbed into it.

It doesn't do it automatically? Try this to move the focus to the
control and select the text:

With Me.ControlName
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top