Combobox behaving strangely (1 Viewer)

amorosik

Member
Local time
Today, 11:28
Joined
Apr 18, 2020
Messages
508
I need your help with a problem that sometimes comes up
A form with some comboboxes and other objects
Inside the RowSource property of the combos are linked to the underlying db
Some combos behave strangely in the sense that if I type in a value that is definitely present among the lines displayed in the combo, and press Enter, the line is not selected
I have attached an example with a code fragment sufficient to explain the problem exactly
To reproduce the error I'm complaining about:
- start the frmMovimentiContabiliInsMod form
- type 1 in the 'Caus. Contabile' combo and press Enter
- the cursor will move to the 'Cod.Cli' combo
- type 5 and press Enter - the error 'Missing list item...' will be displayed

Even if the row with the value 5 in the first column is present
If instead of 5 you type 13 (from 11 onwards) the row is correctly selected
The question is: why are the values 3,5,7,8,9 not 'recognized' when typed?

(Win10 + Access 2013 32bit + db Firebird + odbc)
 

Attachments

If instead of 5 you type 13 (from 11 onwards) the row is correctly selected
Typing 13 didn't work for me either.
1718644290871.png
 
I need your help with a problem that sometimes comes up
A form with some comboboxes and other objects
Inside the RowSource property of the combos are linked to the underlying db
Some combos behave strangely in the sense that if I type in a value that is definitely present among the lines displayed in the combo, and press Enter, the line is not selected
I have attached an example with a code fragment sufficient to explain the problem exactly
To reproduce the error I'm complaining about:
- start the frmMovimentiContabiliInsMod form
- type 1 in the 'Caus. Contabile' combo and press Enter
- the cursor will move to the 'Cod.Cli' combo
- type 5 and press Enter - the error 'Missing list item...' will be displayed

Even if the row with the value 5 in the first column is present
If instead of 5 you type 13 (from 11 onwards) the row is correctly selected
The question is: why are the values 3,5,7,8,9 not 'recognized' when typed?

(Win10 + Access 2013 32bit + db Firebird + odbc)
The example you have attached works ok for me in MS Access 365, but not in MS Access 2010. Using Access 2010 it happens the issue hou have explained.
The workaround for old Access versions is to change the autoexpand property in the cmbAnagraficaCodice combobox to False
 
Last edited:
The example you have attached works ok for me in MS Access 365, but not in MS Access 2010. Using Access 2010 it happens the issue hou have explained.
The workaround for old Access versions is to change the autoexpand property in the cmbAnagraficaCodice combobox to False

Yes, OK
So is it a combobox problem?
I mean, with Autoexpand=true it's not possible to use it?
Why does it work correctly with values above 11 and with values lower than 11 it doesn't work?
 
Yes, OK
So is it a combobox problem?
I mean, with Autoexpand=true it's not possible to use it?
Why does it work correctly with values above 11 and with values lower than 11 it doesn't work?
It seems that's a problem with some old MS ACCESS versions. I've noticed that the problem is caused by the -1 value there are in the table. If you change it for a positive number, then it works with autoexpand=true.
1718657112104.png
 
It seems that's a problem with some old MS ACCESS versions. I've noticed that the problem is caused by the -1 value there are in the table. If you change it for a positive number, then it works with autoexpand=true.
View attachment 114552

I tried and actually removing the -1 also works with Autoexpand=true
This Access is really strange
 
I use 2010 and don’t experience that problem- it may be to do with sorting or the fact I use a union query to combine 3 views, one of which is the -1 value.
 
You must type on Cod.Cli combobox, not on Caus.Contabile
Sorry, I simply followed your instructions. After entering 1 and hitting Enter, that's where the cursor went. So, I didn't even check if I was in the right box.
 
I use 2010 and don’t experience that problem- it may be to do with sorting or the fact I use a union query to combine 3 views, one of which is the -1 value.

I'm confused
Did you use the example I posted or did you make your own example?
 
Did you use the example I posted or did you make your own example?
I used a combo in an existing app of mine and was commenting about the suggestion that -1 was the cause. I’m on my phone so cannot review your example but provided a couple of reasons why perhaps it works for me and not for you
 
now at my desk and taken a look and can see the issue. If you remove the sort order it works.

It may well be an issue with 2010 but I have never experienced it (until now :giggle:)

I do recommend you make your bound field (CODICE_ANAGRAFICA) required and indexed no duplicates as it could cause issues with selecting the correct record - but not this one.

Also I note you are allowing zero length strings in your table design. You may have your reasons but generally not a good idea. And your query is filtering on TIPO_SEDE_DIVERSA =' ' ( a space) - pretty dangerous as you cannot see a space (or a zls) so your filtering may well not produce the list you expect
 
I can confirm the problem in A2010 as well. I don't know why it would be the case either.

You do need to adopt the suggestions CJ_London recommends, though. It's especially unnerving to see a single space as a valid filter.
 
I tried and actually removing the -1 also works with Autoexpand=true
This Access is really strange
In the original database example you uploaded, with no changes, I've also noticed that if you press the space key after typing the Cod.Cli.: 5 it works properly and the client 5 is selected using MS Access 2010.

1718770177770.png
 
Last edited:
You are right
I hadn't noticed it
This could already be a possible work-around, even if it is not clear why if I type 11 it takes it immediately while if I type 5 it needs the space
 
I find also works correctly if you type the space before the Cod.Cli: 5

It almost seems that the combo box is expecting two characters even though it is nominally a long integer. This bears further testing with a different set of data and a different combo box.
 
One more thing. I changed the value from -1 to a 0 in the CODICE_ANAGRAFICA field in your table. The combo box started working correctly, matching the typed entry 5.

I changed the sort order so that the -1 sorts to the last position. The combo box worked correctly.

I think the use of a negative number in that field, and sorting on it, has something to do with the behavior.
 

Users who are viewing this thread

Back
Top Bottom