By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,482 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Annoying Listbox Quirk

P: n/a
Using Access 2007 I find that, on opening a form, a listbox control
always displays one of the values in the list, even if no value has
been selected. Thus, the first value in the list is displayed
(without highlighting) when the field has a null value. The user may
then change the displayed value by clicking on the up or down arrow to
the right of the control. This newly displayed value will also be
without highlighting and will be unselected. No value will actually
be selected until the user clicks on the displayed value or tabs
through the control while that value is displayed. I assume the lack
of highlighting is supposed to signal that the displayed value has not
been selected. However, my users don't know this and if the
unhighlighted value displayed in the list box happens to be the one
they want, they just save the record without ever clicking on or
tabbing through the listbox control. As a result, a null value is
stored in that field and the user is hopping mad that his "data entry"
didn't work.

I have worked around this by hooking a subroutine to the "On Save"
form event to check for a null value in the field referenced by the
listbox control. A message box tells the user he/she must click on
the value displayed in the listbox control to "select" the item they
think they have already chosen. This is pretty lame.

Ideally I should be able to programmatically check to see which item
is displayed (even if unselected) and, simply write that value to the
appropriate field when the record is saved without bothering the
user.

I can use the ItemData property of the listbox object to read the
values of the various items in the list, but I can't find any property
which tells me which of these values is currently being displayed.

Extensive Googling has been unsuccessful in yielding an answer. Any
suggestions would be appreciated.

John

Jun 14 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Jun 14, 1:26 am, John <brimjo...@gmail.comwrote:
Using Access 2007 I find that, on opening a form, a listbox control
always displays one of the values in the list, even if no value has
been selected. Thus, the first value in the list is displayed
(without highlighting) when the field has a null value. The user may
then change the displayed value by clicking on the up or down arrow to
the right of the control. This newly displayed value will also be
without highlighting and will be unselected. No value will actually
be selected until the user clicks on the displayed value or tabs
through the control while that value is displayed. I assume the lack
of highlighting is supposed to signal that the displayed value has not
been selected. However, my users don't know this and if the
unhighlighted value displayed in the list box happens to be the one
they want, they just save the record without ever clicking on or
tabbing through the listbox control. As a result, a null value is
stored in that field and the user is hopping mad that his "data entry"
didn't work.

I have worked around this by hooking a subroutine to the "On Save"
form event to check for a null value in the field referenced by the
listbox control. A message box tells the user he/she must click on
the value displayed in the listbox control to "select" the item they
think they have already chosen. This is pretty lame.

Ideally I should be able to programmatically check to see which item
is displayed (even if unselected) and, simply write that value to the
appropriate field when the record is saved without bothering the
user.

I can use the ItemData property of the listbox object to read the
values of the various items in the list, but I can't find any property
which tells me which of these values is currently being displayed.

Extensive Googling has been unsuccessful in yielding an answer. Any
suggestions would be appreciated.

John
Might be a .Focus issue. Call a fuction that takes Focus away from
the list boxes. Also there should be a property that allow you to
select nothing.

Jun 14 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.