J
John
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
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