473,385 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

placing text insertion point at the end of combobox contents

Hi all. This is a bit of an aesthetic problem.

I have a form containing two subforms and two comboboxes. When the forms first load, the first combobox receives focus. I'd like the text input cursor to be placed at the end of the text whenever the bombobox receives focus. Trolling Bytes.com tells me that the following code works for most people, so I put it in the cboEmpID_AfterUpdate event procedure.
Me.cboEmpID.SelStart = Len(Nz(Me.cboEmpID, ""))
It doesn't work for me, for whatever reason. The combobox receives focus and selects all its text, as usual. I also unsuccessfully tried adding the following, but to no effect:
Me.cboEmpID.SelLength = 0
Perhaps this has to do with some SetFocus shenanigans that runs right before, but I'm not sure. This is in place so that the datasheets in the subforms don't have their first cells selected. Here's the code:
subfrm_Emp.SetFocus
cboEmpID.SetFocus
Once again, this is aesthetic; the form runs perfectly otherwise.
Jan 3 '12 #1

✓ answered by yptrumpet

Seems I figured out the problem. I made it so that the above-mentioned line of code runs in the combobox's Enter and Change event procedures. Putting it in the AfterUpdate procedure didn't do anything that I could see. Enter() takes care of when the control first receives focus, and Change() takes care of when a new value from the combobox options is selected.

Well. Throw your head against a wall enough times and you just might get through. I'm also happy to report minimal brain damage from this frustrating experience.

Mods, please mark this as "answered." I can't do it.

1 2530
Seems I figured out the problem. I made it so that the above-mentioned line of code runs in the combobox's Enter and Change event procedures. Putting it in the AfterUpdate procedure didn't do anything that I could see. Enter() takes care of when the control first receives focus, and Change() takes care of when a new value from the combobox options is selected.

Well. Throw your head against a wall enough times and you just might get through. I'm also happy to report minimal brain damage from this frustrating experience.

Mods, please mark this as "answered." I can't do it.
Jan 3 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Niels | last post by:
Hello, I'm trying to get te index of a specific text in a ComboBox. The ComboBox is filled by searching for filenames in a directory. The text of the last item selected in the ComboBox is saved in...
1
by: bart | last post by:
I'm trying to place text at a certain point on the console. But I can't figure out any way to do this. For instance place a '@' at point 6,8. Any hints? (I'm trying to display a 'map'. Think...
0
by: sympatico | last post by:
I'm developing a program that allows the user to click a button to input an html tag into a text document. What I'm having trouble finding is how to insert the text at the insertion point instead...
3
by: (Pete Cresswell) | last post by:
I've got this DoCmd in a fields Change() event so that as the user types, the underlying table (also visible in another screen...) will be updated in realtime - instead of waiting for the screen TB...
3
by: | last post by:
Hello, I try to format the text of a combobox with DropDownStyle "DropDown". I just mean the text which is displayed when the combobox isn't touched. Usually it displays the ToString() method of...
4
by: Arif | last post by:
how to display combobox contents(the same function that occurs when Mouse is pressed on a combobox but) on MouseEnter/MouseHover events? arif.
2
by: DaveR | last post by:
Can anybody help me to a)get the user's cursor insertion point (caret) from a multiline textbox, using client-side script I suppose, and then b)return the position to VB code behind? I have...
19
by: tkpmep | last post by:
I have an ordered list e.g. x = , and given any positive integer y, I want to determine its appropriate position in the list (i.e the point at which I would have to insert it in order to keep the...
0
by: Jon Paal [MSMD] | last post by:
anyone have a quick example of using insertion point of data with MSWC.Tools ? e.g. how can I send data to "div" tag ? Set oTools = Server.CreateObject("MSWC.Tools" ) oTools.processForm...
0
by: Jon Paal [MSMD] | last post by:
anyone have an example of using insertion point of data with MSWC.Tools ? e.g. how can I send data to a "div" tag ? Set oTools = Server.CreateObject("MSWC.Tools" ) oTools.processForm...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.