Listbox value

So, although a value is showing, you can never read what it is ? Please let me know so I can try something else. Thanks!
 
? i there is no Highlight on the listbox, then nothing is selected therefore the its Value is Null (nothing).
Actually, no that is not true. In Form Load I have listPosTo = 10 after the 100 additems. This is so it initially shows 10.
? listPosto shows 10. even though nothing is selected.
 
? i there is no Highlight on the listbox, then nothing is selected therefore the its Value is Null (nothing).
Actually, no that is not true. In Form Load I have listPosTo = 10 after the 100 additems. This is so it initially shows 10.
? listPosto shows 10. even though nothing is selected.
it should be highlighted as you are setting its value to 10 with code

with a value list you can set the listbox value to anything with code even if its not in the list.
 
what is ListPosTo? what are you trying to solve List4 or ListpostTo.
actually Yes, when nothing is Highlighted, nothing is Selected, therefore No value.
if it is selected, even if you focus on another control, it will still be selected and will retain its Value.
 
OK. Thanks for everyone's help. I've redesigned the Form to use a 3 line Dropdown and pre-slected default values to avoid Null.
I still think there should be a way to get the value showing in the Listbox (when there's no dropdown) without clicking it but I'll have to give up on that even though it worked better in the Form.
 
Hi Arne as per Msg 1 ListPosto/From hold items 1 to 100. List4 contains 4 digit years from SQL. There's also a text box holding a start year (setup in another Form). The idea is the user selects a Year range, then a range anywhere between 1 and 100. I think the problem was no dropdown. Without that the user could click through to the required values, which nicely rotated into view. Excellent. Except bloody Access wouldn't let me get the value showing.
 
Ah, on thinking more I have set a listbox height to 0.6cm to match some other controls. Is this preventing a drop down ?
Hi. Although you made the Listbox height only tall enough to show one item, that item is not selected until you click on it.
 
I follow that, but it shouldn't be necessary as you've already just moved the item into view with the up/down things.
However it ain't a perfect world...
 
I use a lot of listboxes and cant think many instances where I used one where I've had to scroll. If there are too many items to show in a list I would use a combobox. It would seem to me that you should be using a combobox for a 100 item list.

If you want to have a textbox with up/down arrows you can certainly do that with code.

edit:forgot to include that you can set a button to auto repeat in the property sheet.
 

Attachments

Last edited:
If there are too many items to show in a list I would use a combobox.
You can have large data sets using listboxes, here is one holding 46,000 rows. I based it loosely on John Big Booty search listbox found here. You can wheel scroll or use the scroll bars or double click. It would be faster to use a search function with large data sets.

1602567882457.png
 

Attachments

  • 1602566859380.png
    1602566859380.png
    91.4 KB · Views: 149
Last edited:
I follow that, but it shouldn't be necessary as you've already just moved the item into view with the up/down things.
However it ain't a perfect world...
Hi. I think that's a misconception. If you enlarge your listbox to show two rows of items and click your down arrow a few times, which of the two items displayed is selected?
 
Listboxes don't have dropdown arrows. They are fixed in height.

Also, why is your ListBox not bound to a RowSource query so you can avoid writing code to populate it?
 
I reread this a few times, and it sounds what you describe is behavior like a spinner control. As you move up and down the value is selected. In the listbox you have to click into the list and select. See if this is the behavior you want. I put both the listbox shrunken down to show one row and a spinner control. The spinner control is an Active X control under MSFORMS
 

Attachments

I reread this a few times, and it sounds what you describe is behavior like a spinner control. As you move up and down the value is selected. In the listbox you have to click into the list and select. See if this is the behavior you want. I put both the listbox shrunken down to show one row and a spinner control. The spinner control is an Active X control under MSFORMS
I agree with @MajP , I get the same impression about the OP wanting a spinner functionality. However, and this is directed at the OP, if you are populating the choices with values from 1 to 100, I wonder how effective a UI it would be to ask the user to click on a button 100 times to get the value 100?

Just a thought...
 
Last edited:
Although not suggesting this is a good UI, you actually do not have to click. You can just hold the button and set the delay to a very small number. It will scroll really fast automatically.
 
Although not suggesting this is a good UI, you actually do not have to click. You can just hold the button and set the delay to a very small number. It will scroll really fast automatically.
Ah, that would be an advantage of using an ActiveX control over the original Listbox design then. Thanks!
 
Last edited:
However, still would think a combobox would be the best UI since it sounds like it is not multiselect.
 
Hi. I think that's a misconception. If you enlarge your listbox to show two rows of items and click your down arrow a few times, which of the two items displayed is selected?
As far as I can tell, none. But you're only showing one item... then that's the one you want.
 
Also, why is your ListBox not bound to a RowSource query so you can avoid writing code to populate it?
There isn't a rowsource query. That would mean having a table holdeing 1 to 100 ? Isn't additem in a loop far better ?
 

Users who are viewing this thread

Back
Top Bottom