|
|
Set the cursor position
I have a field with an input mask. When the user wants to type in that
field, they sometimes simply click in the field and start typing.
But I want them to always start entering data at the first position of the
field (which is usually not where they click).
What sort of VBA code would I use to move the "cursor" to the first position
of the field (I assume this would be in a GotFocus event ... or something
like that)??
thanks. bob.
|
|
0
|
|
|
|
Reply
|
Bob
|
3/11/2008 9:28:34 PM |
|
On Tue, 11 Mar 2008 14:28:34 -0700, Bob Howard wrote:
> I have a field with an input mask. When the user wants to type in that
> field, they sometimes simply click in the field and start typing.
>
> But I want them to always start entering data at the first position of the
> field (which is usually not where they click).
>
> What sort of VBA code would I use to move the "cursor" to the first position
> of the field (I assume this would be in a GotFocus event ... or something
> like that)??
>
> thanks. bob.
If the user clicks into the field, the cursor position will be where
ever the user has clicked.
If the user tab's into the field, you can position the cursor at the
beginning.
Code the control's Enter event:
Me.[ControlName].SelStart = 1
Or ...
to position it at the end of the existing data, you can use:
Me.[ControlName].SelStart = Len(Me.[ControlName])
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|
|
0
|
|
|
|
Reply
|
fredg
|
3/11/2008 9:49:54 PM
|
|
"fredg" <fgutkind@example.invalid> wrote in message
news:1f9ot7jbk0m33$.6n9iyhrn7puc.dlg@40tude.net...
>
> If the user clicks into the field, the cursor position will be where
> ever the user has clicked.
There's a workaround for this, but it may be more trouble than it's worth.
You can cover the text box with a transparent command button, making sure
that (a) the command button is in front of the text box, and (b) the command
button's Tab Stop property is set to No//False. Then you can the command
button's Click event procedure to set the focus to the text box.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
|
|
0
|
|
|
|
Reply
|
Dirk
|
3/11/2008 10:05:25 PM
|
|
OnEnter only works if the textbox is tabbed into, not if it's clicked in.
Private Sub YourTextBox_Click()
Me.YourTextBox.SelStart = 0
End Sub
--
There's ALWAYS more than one way to skin a cat!
Answers/posts based on Access 2000/2003
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1
|
|
0
|
|
|
|
Reply
|
Linq
|
3/12/2008 3:21:42 AM
|
|
|
3 Replies
1178 Views
(page loaded in 0.002 seconds)
Similiar Articles: Set the cursor position - microsoft.public.access.formscoding ...I have a field with an input mask. When the user wants to type in that field, they sometimes simply click in the field and start typing. But I want... How to change the default position of cursor when writing an email ...how do I set default save location when saving email attachments ..... cursor? - microsoft ... how do I set default save location when saving email attachments ... Cursor position - microsoft.public.access.formsCursor.Position Property Gets or sets the cursor's position. [Visual Basic] Public Shared Property Position As Point [C#] public static Point Position {get; set;} [C++ ... How to determine the current cursor position in the selection of a ...It is essentially the character count from the start of the current 'line' to the cursor position ... of that Dim oRng As Range Dim iCol As Integer Set oRng = Selection ... Cursor position with input mask - microsoft.public.access ...Set the cursor position - microsoft.public.access.formscoding ... I have a field with an input mask. When the user wants to type in that field, they sometimes simply click ... W2003: find cursor location in table coordinates (table/row/column ...I've been asked to extract data from an existing form that I didn't set up, and the format is less than ideal. To minimize my cycles of testing, i... Cursor position upon opening form - microsoft.public.access ...Cursor position upon opening form - microsoft.public.access ... place cursor in a specified text box in a Word form - microsoft ... Set the cursor position - microsoft ... How to place cursor at the end following Setfocus? - microsoft ...Do you mean you want to set the Cursor location at the end of whatever is in txtFilter? If so, you can do this: Me.txtFilter.SetFocus Me.txtFilter.SelStart = Len(nz(Me ... New Doc Cursor Position - microsoft.public.word.pagelayout ...Set the cursor position - microsoft.public.access.formscoding ... position of cursor wrong when opening new document - microsoft ..... position of cursor wrong when ... position of cursor wrong when opening new document - microsoft ...Set the cursor position - microsoft.public.access.formscoding ... position of cursor wrong when opening new document - microsoft ..... position of cursor wrong when ... Console.SetCursorPosition Method (System)Sets the position of the cursor. ... Use the SetCursorPosition method to specify where the next write operation in the console window is to begin. Cursor.Position Property (System.Windows.Forms)private void MoveCursor() { // Set the Current cursor, move the cursor's Position, // and set its clipping rectangle to the form. this.Cursor = new Cursor(Cursor.Current ... Visual Basic Procedure to Get/Set Cursor Position - Microsoft SupportYou can make a Windows API (application programming interface) call to a Microsoft Windows DLL (dynamic-link Library) to get and set the current cursor ... FreeVBCode code snippet: Set the Mouse Cursor PositionThis is the snippet Set the Mouse Cursor Position on FreeVBCode. The FreeVBCode site provides free Visual Basic code, examples, snippets, and articles on a variety of ... Setting mouse cursor position with WinAPI | .NET ZoneSetting the mouse cursor position on a Windows machine with the help of .NET Framework shouldn't be that big of a problem. After all, there is the built-in... 7/19/2012 7:52:18 PM
|
|
|
|
|
|
|
|
|