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!

Inserting string to text in text box

Status
Not open for further replies.

tomhughes

Vendor
Aug 8, 2001
233
US
I am trying to use a button to add a string into a text box at the cursor location. Does anyone know how to determine where the cursor is in a string in a text box ? I am using Access 97, and have tried using macros, and using the sendkeys command. The macro overwites everything, and I have not been able to get the sendkeys to work.
 
I think you need to grab the curLine and curX properties of the textbox
curLine givs the current line (if it is a multi line)
curX gives the current insertion point (ie where the cursor is)
so myCursorPosition = textbox1.curX

However, this gives the position in himetrics (0.0001m)
so I don't know how useful this is.
You could also look at the seLength property which gives the number of charcters SELECTED - so you would have to select the characters 1st
Hope this points you in the right direction
Geoff
 
OK - Thanks - I was not aware of these properties - Where can I go to get these parameters and others that may be helpful ???
 
I just typed current cursor position in the help file for VBA and it came up with these
Try typing the individual names (CurX / SelLength etc) into the office assistant jobby
HTH
Geoff
 
I have had no success at all in trying to accomplish this task.When I try to get the data I want I get an error that says I have to first set the focus on the control, however when I do, the whole text is selected, and any cursor position is lost.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top