Combo box list

A

A Hopper

I have a combo box that uses a table with employee names
and numbers as it's source. Each time an employee enters a
record they scroll through the list to find their name. Is
there a way that I can have the most recent user move to
the top of the list and remain there until a different
employee selects and then that employee would move to the
top of the list. Each time the form is closed and reopened
I would like the list to go back to it's orginal order.

Thanks in advance for you help
Allan
 
J

Jeremy Vyska

One easy way to do that would be to add a 'Last Selected'
Date/Time field to the table. Everytime that list has an
entry selected (perhaps On_Click?), populate the 'Last
Selected' field for that entry with 'Now'.


When the form closes, purge all the 'Last Selected'
fields, which is very easy to do quickly with an Update
query like this:

UPDATE tblEmployee SET tblEmployee.LastSelected = Null
WHERE (((tblEmployee.LastSelected) Is Not Null));


With that in place, set the first sort order for the
combo box to 'Last Selected', then your normal sorting.

Does that make sense and is helpful?

Jeremy
 
A

A Hopper

Jeremy, today has been a day to do and redo updates. Lots
of bugs. I haven't had a chance to try your suggestion,
however, I think I understand how it works. I am not
certain were I set the "sort order". Is that in the row
source SQL Statement?
Thanks your response and your help.
Allan
 
J

Jeremy Vyska

Yes. Sort is part of the Rowsource property. When you
use the query builder, you can set which fields are
sorted and whther be ascending or descending.

Jeremy
 

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

Top