Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus at the end of a text field that has a value 2

Status
Not open for further replies.

jflo

Programmer
Mar 13, 2001
44
0
0
CA
I have a small form that allows a user to enter a couple of thousand of documents number, one at a time, and assign it to a user. The numbers aren't sequential but are usually just a couple of numbers apart. On my form, once you clicked on "OK" to validate the entry, you then get the same form with the drop list of user set back to no user and the document number field containing the last entered number keeping only the 6 characters from the left. That part works. What I need now is to have the focus set after the last character so the user only have to type the missing info. And if we need to change the thousand digit, then just hit one backspace and voilà.


Example:
If DocNumber --> V09876543 then the form comes up with
V09876. I can set the focus to that field but it Access has it all selected, I want the cursor to be set after the last digit. Any ideas? Does it make any sense?
 
Makes perfect sense to me an easy to do. Ready?
tools>options>keyboard.
On the behavior entering field, click "go to end of field".
Nothing to it.

Robert Berman

 
Thanks thornmastr,

It makes sense but is there a more "programatical" way? Some of my users only have the run time version of Access 97 and I'm not sure this would apply.

For this particular case that solves it but...

Any other ideas?
 
I don't think there is a way to do this via code. Yet another argument for split fe/be Applications. You could make the change and have the users download the updated FE.

Robert Berman
 
This should work:

Me![TextBoxName].SetFocus
Me![TextBoxName].SelLength = 0
Me![TextBoxName].SelStart = Len(Me![TextBoxName]) + 1

Bob Scriver
 
That's what I was looking for. Works like a charm. Here's a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top