J
JP
I have a form with a listbox on it. Neither the form nor the listbox is
bound to any table or query (the form is a main menu kind of form, and the
contents of the listbox are the various program functions).
The row source for the listbox is a query against a table. When this form
displays, I want to default select the first item in the listbox (i.e.,
actually have it highlighted). To do this I put code in the Open event for
the form as follows:
Me.lstMenu.Selected(1) = True
(Note that the listbox does display column heads, so that the first row of
actual data is row 1 instead of row 0)
This highlights the first line of data. HOWEVER, when I have this code in
there, nothing on the form works. I can't click on any of the command
buttons, I can't select some other item in the list box, I can't type into
any of the text boxes -- just nothing works.
Anyone have any ideas as to why this is happening? Is there a
better/correct way to default an item in a listbox?
Thanks in advance.
bound to any table or query (the form is a main menu kind of form, and the
contents of the listbox are the various program functions).
The row source for the listbox is a query against a table. When this form
displays, I want to default select the first item in the listbox (i.e.,
actually have it highlighted). To do this I put code in the Open event for
the form as follows:
Me.lstMenu.Selected(1) = True
(Note that the listbox does display column heads, so that the first row of
actual data is row 1 instead of row 0)
This highlights the first line of data. HOWEVER, when I have this code in
there, nothing on the form works. I can't click on any of the command
buttons, I can't select some other item in the list box, I can't type into
any of the text boxes -- just nothing works.
Anyone have any ideas as to why this is happening? Is there a
better/correct way to default an item in a listbox?
Thanks in advance.