Cursor position in combobox

dallas.langevin

New member
Local time
Today, 00:33
Joined
Apr 18, 2013
Messages
3
I have several comboxes where I'm using date/time input masks. When I go to enter data in the field the cursor is situated at the right end of the box. I have to backspace to the beginning of the field to enter the data. How do I position the cursor to the beginning (left side) of the field?
 
So there's no setting in the forms property sheet that I can set? I have to write vb code? Don't know how to do that nor where I would put it since I've been using the access wizard
 
You would put the code in the Combo's Got Focus event. (I'm currently working from memory, as I'm on the road and this machine does not have Access. The description should be pretty accurate but some of the word may be slightly different).

With your form in design view, click on the combo. Now go to the properties pane, and click on the event tab. Click in the On Got Focus row and select Event Procedure from the drop down list. Now click the ellipsis to the right of the row, this will open the code window.

The cursor should be positioned below a heading that mentions the Combo name and Got Focus, or similar, and above a line that says something along the lines of End of procedure.

Paste/type the following code between those two line, adjusting the red highlighted portion to reflect the reality of your DB;
Code:
Me.[B][COLOR="Red"]YourComboName[/COLOR][/B].SelStart = 0
If you type this manually into the code window, Access will automagically prompted you with a list of appropriate control names, when you type the full stop after the Me
 

Users who are viewing this thread

Back
Top Bottom