?
Solved

How do I stop combo box from going to end of first found record?

Posted on 2013-06-25
15
Medium Priority
?
358 Views
Last Modified: 2013-07-12
Using MS Access 2007 I have created a bound combo box that has a query as its RowSource. When I type in a number I want it to display the entries in the rowsource and let me progressively enter the numbers and see the matchin results. For some reason as soon as it finds a record that commences with the first number(s) I enter it automatically selects that record and jumps to the end of the field. How do I stop this and force it to display a list.

E.g. The RowSource has records that look like the following. As soon as I enter 3 in the combo box it automatically selects the first record that commences with a 3 and fills the box. I want it to simply display the entries starting with 3 and let me keep typing:
1000234625638752
2000456825895236
3000285864265848
3000864965246297
3000958746388468
0
Comment
Question by:Rob4077
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 4
15 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 39277280
Are you sure the value is being selected and not just suggested?  When you type a character, Access displays (as a suggestion) the first value that satisfies the selection but if you type more characters it changes the suggestion to fit what you have typed.
0
 

Author Comment

by:Rob4077
ID: 39278390
No, it fills the entire box with the number and moves the cursor to the end of the field. I've used combo boxes before and not seen this behaviour so I was wondering if I had perhaps changed a setting or something.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 39278432
Do you have any code in any combo box event  (for this combo box, clearly)?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:Rob4077
ID: 39280886
Yes I have an On Got Focus event that does a requery of the rowsource (the rowsource is a list of all numbers that have not yet been allocated) and an After Update event that checks to make sure the entered number is not already in the bound table (the allocated numbers). There is no On Change event - if there were an On Change event I would expect this type of behaviour may be possible.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 39281452
I think you will have to try running without any code to see if makes any difference.

Comment-out  all of it and see what happens and then uncomment one event at a time to try to pin down the source of the problem.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 1200 total points
ID: 39287706
Make sure the "AutoExpand" property of the combobox is set to: Yes

...and let's be clear on this, as Pete stated...
"I want it to simply display the entries starting with 3 and let me keep typing:"
A combobox will not "Filter" a list, it will jump to the first matching entry if you simply start typing into it...
It will "jump to" all values that match what you start typing, only IF you drop the box down first.
(Again, this is not "filtering" the list for matching entries)

For example, this attached database works just fine for me...
Sample.mdb
0
 

Author Comment

by:Rob4077
ID: 39289622
Sorry, I keep getting called away to other projects. The way your combo box works is exactly how I thought it should. It displays the records commencing with the number(s) entered. Mine enters the number in the field and moves the cursor to the end of the number as soon as it finds the first match. I will try to have another look at it tomorrow to see if I an figure out what I am doing wrong.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39292173
Again:
"Make sure the "AutoExpand" property of the combobox is set to: Yes"
0
 

Author Comment

by:Rob4077
ID: 39292488
Hi Boag2000. Just confirming that the AutoExpand property is and was set to Yes. As soon as I enter a 3 it selects the first record starting with 3 and jumps to the end of it ready for me to type in additional numbers.

However I figured out what it was that was causing the problem. I had an input mask of 0000\ 0000\ 0000\ 0000;;" "
to make it easier to read and that appears to cause problems. When I inserted the same input mask in the sample database I get the same outcome.

So is there any other way of making the numbers appear in groups of 4 digits for clarity?
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 800 total points
ID: 39292553
Remove the input mask and set the Format property to :

@@@@-@@@@-@@@@-@@@@
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39294653
I think Pete has your solution there...
0
 

Author Comment

by:Rob4077
ID: 39298762
Indeed he has. Thanks Pete! I will share points for contribution.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39299054
No need to share the points, Pete has answered your question directly.
;-)
0
 

Author Comment

by:Rob4077
ID: 39299781
True but your sample db lead me to realise what gave rise to the problem
0
 

Author Closing Comment

by:Rob4077
ID: 39320660
Sorry for the delay. I thought I had closed it out
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question