List box error

G

Guest

How do I set focus away from a list box? I have 4 list boxes on a tab
control that are interdependant. I.e. the value of one becomes criteria to
requery the next. When I requery the 1st list box, I set the focus to it and
set the List Index property to have a record selected to use in the second
list's query criteria. Then I need to do the same for the 2nd-4th list
boxes. The problem is that once I set the focus to the 1st list box, I can't
move it. SetFocus to the form executes, but the focus stays on the list box.
SetFocus to any other control causes 'Runtime Error 2115: The macro of
function set to the BeforeUpdate or ValidationRule property for this field is
preventing Microsoft Access from saving the data in the field.' I don't have
any functions set for either property
 
G

Guest

Based on the error you are getting, I am guessing your list box control is
bound to a record source field. I avoid using either combo boxes or list
boxes as bound controls. I only use a list box if it is necessary to allow
multiple selections. The problem with a multi select list box is that
querying the control by name returns Null.

Another problem is that using an event like After Update, which would seem
the logical place to set focus to the next control, fires every time you make
another selection. The user can use the Tab key to move to the next control.

So, if your list box does not require multiple selections, I would recommend
changing it to a combo box. It is easier to deal with and provides the Auto
Expand fucntionality not available in a list box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top