List Box Focus

JC3

Registered User.
Local time
Today, 15:06
Joined
Jun 13, 2005
Messages
53
Hi

I have a list box setup with all the dates from 01/10/05 to 31/12/08.

I want to always start the list box at the current date while still allow the functionality to backdate if required.

I have used the undernoted code to set the row correctly but I cannot figure how to get the box to scroll down to the correctly selected row.

Code:
    Dim i As Long
    
    i = DLookup("ID", "tblIMDates", "cdate([Date])=date()") - 1
    
    Me.lstDates.Selected(i) = True

Any ideas?

JC
 
Set the default value of the Listbox to Date()
 
Tried both suggestions with no luck.

For your information the Multi Select List Box is unbound and I use the results to update a separate table.

Any other ideas?
 
See if there isn't something here that can shed some light on the subject.
 
Thanks everyone for your help.

Simply used the below code.

Code:
me.lstbox.ListIndex = desiredrow

I knew it would be simple in the end.

Thanks again.

JC
 

Users who are viewing this thread

Back
Top Bottom