Make listbox autoselect if only 1 item

BJF

Registered User.
Local time
Today, 15:23
Joined
Feb 19, 2010
Messages
137
Hello,
I'm having a hard time improving the functionality of my inventory form, hopefully someone can help!

My form utilizes five list boxes. The user must choose from each of the five list boxes in order to filter out a specific product from a products table.

Every time the user makes a selection, the next listbox is filtered, and set focus to. Each listbox often contains more than 1 choice within it, however, there are a few cases where there is only 1 choice to be made.

How can i determine with code when a particular listbox only has 1 choice so that I can have the choice be made automatically and then set the focus to the next listbox in the series?

Thanks for any help,
Brian
 
Lookup ListBox in the docs and find the property that tells you how many items there are.
 
Thanks, i found the listcount property and I'm able to determine when my listbox has only 1 value in it, but how do I select that value before setting focus to the next listbox?

Thanks for any advice, I'll keep looking in the meantime
Brian

thanks I found the answer:

Me.cboDescription = Me.cboDescription.ItemData(0)

in case someone else needs it!

Good luck!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom