Mike,
No can do, using the default listbox behavior. Focus will always move to
the matching value in the 1st column.
You might be able to code something in the KeyPress event to move to the
entry in the 2nd column (I've never tried it).
Or you could create a combo box that lets the user choose from a predefined
list of sorting options, and update the listbox rowsource with a new
rowsource, ie:
control: comboBox
columns: 1
RowsourceType: ValueList
RowSource: Title then Author; Author then Title; Year then Title then Author
In the AfterUpdate event of the combobox, add code like this:
if me.comboBox = "Title then Author" then me.listBox.Rowsource = "SELECT
Title, Author FROM Tables ORDER BY Title, Author;"
elseif me.comboBox = "Author then Title" then me.listBox.Rowsource = "SELECT
Author, Title FROM Tables ORDER BY Author, Title;"
elseif me.comboBox = "Year then Title then Author" then me.listBox.Rowsource
= "SELECT PublicationYear, Title, Author FROM Tables ORDER BY
PublicationYear, Title, Author;"
endif
You'll have to futz around with column counts, widths, etc.
In the end, you'll probably be better off creating separate combo or list
boxes for each field you want to search.
"Mike Top" <mi******@rogers.com> wrote in message
news:ec**************************@posting.google.c om...
I want a listbox to position to a letter provided by the user.
Normally, when the user keys a letter, the listbox positions
automatically to the first entry starting with that letter in the
first column.
I want to allow the user to select the column to be searched.
For eaxample, assume a list box that looks like this:
____________________________
| Title | Author |
|----------|----------------|
| Oklahoma | Hammerstein, O |
| Hamlet | Shakespeare, W |
.
.
Now, assume the listbox is sorted on the second column (Author), but
the column sequence stays as is. If the user keys a "S", I want the
list to position on the second entry.