force cursor to start of field module

Davros

Registered User.
Local time
Today, 10:34
Joined
Sep 9, 2005
Messages
131
I avoid modules like the plaque but now i need to use one.
what i need to do is to force the cursor to the begining of each text field in my forms whether i enter the field using the tab or mouse control [i tried the options in the menu but its not what i need - its possible to enter the text field using the mouse and position the cursor in the middle of the text] . i have about 50 text fields so i would like to avoid writing the code for each text box. i think i need a public variable but how would i go about coding it??

thanks in advance
 
You can just put something in the Got Focus command for each text box:

Me.YourTextBoxNameHere.SelStart = 0

that's the simplest, but you could create a function to do it and call it but it really isn't going to save you much typing, if any at all.
 
thanks boblarson
i'm familar with this method. i just thought if i could put it in a module i would only need to call it once.

cheers anyway
 
Yeah, for that one, the code to put it in a module and then pass the form/control name would actually take more typing.
 
You would only need to call it once; once from each textbox!
 
You would only need to call it once; once from each textbox!

Exactly, my point. If you create a module to do it, in order to be able to get the form and control name for the code, it would take more typing in each control than to just enter the SelStart code in each control.
 

Users who are viewing this thread

Back
Top Bottom