How to Set Focus in Listbox on Records by Date

E

elvindeath

I'm hoping someone can help me with a small project I've been working
on. I'm a totally novice when it comes to VB or coding, so maybe I'm
missing something very basic here.

I've got a form with a 8 line listbox (lstGroups) which contains a few
hundred records, each of which includes a date field (RecordDate).
For various reasons, I need to display records in the listbox where the
date is somewhat older (up to a year) than the current date. Records
are displayed in the listbox sorted by date, but they start with the
oldest RecordDate. Most of the work being done, however, involves
records whether the RecordDate is "after" the current date, so when the
form is accessed, a user generally has to scroll down past 50 - 100
records to find the one they need to access.

Rather than having to scroll through hundreds of records to find the
records I need, I would like to have the form open and immediately
"highlight" the first record in the listbox where the RecordDate is
later than the current date. How can I most easily do this ?

Any help or insight appreciated.
 
M

Mr B

elvindeath,

Although it should be possible to locate the record you indicate you want to
find and select in your list box, more information would be needed to try to
help you locate that record.

In the mean time, I mignt make a suggestion. You mention that this listbox
contains a few hundred records. That is quite a lot of items to have in a
listbox and the expect the user to locate the correct one. You might
consider placing a couple of text boxes on you form for a beginning date and
an ending date and allow the user to provide these two dates and then filter
your listbox to only show the records where the date you are refering to is
between these two dates.

This should greatly reduce the number of records throught which the user
would have to scroll.

Just a thought.
 
E

elvindeath

elvindeath,

Although it should be possible to locate the record you indicate you want to
find and select in your list box, more information would be needed to try to
help you locate that record.

In the mean time, I mignt make a suggestion. You mention that this listbox
contains a few hundred records. That is quite a lot of items to have in a
listbox and the expect the user to locate the correct one. You might
consider placing a couple of text boxes on you form for a beginning date and
an ending date and allow the user to provide these two dates and then filter
your listbox to only show the records where the date you are refering to is
between these two dates.

This should greatly reduce the number of records throught which the user
would have to scroll.

Just a thought.

Mr. B - that's a great idea. I'm surprised I didn't think of
it ! :) That will accomplish exactly what I need to accomplish,
with little coding required. Thanks !
 

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