Friday, August 10, 2007

Highlighting Text In A Field

Thanks to Kath for bringing this simple tip to my attention.

If you want to ensure that the text in a field is easy for the data entry person to overwrite, use the following code (for a field named txtName).


txtName.SetFocus
txtName.SelStart = 0
txtName.SelLength = 10

2 comments:

Vickie Chapman said...

Seems to me like the 3rd line should be
txtName.SelLength = len(txtName)

Otherwise,you won't be over-writing the stuff past 10 characters.

Garry Robinson said...

The original code worked fine for variable length data.