|
Subject:
|
USER SELECTION FROM A COMBOBOX
|
|
Posted By:
|
AxeSess
|
Post Date:
|
2/13/2004 4:15:03 PM
|
Hello
Is there a way in VBA of setting a particular row in a combobox to display at the top of the list?
That is, we have a cbo that contains a list of training dates (this can be as much 80+ dates). The recordsource comes via VBA/SQL depending on a course type that is selected from another cbo.
At present when a user wishes to select a date there is a lot of scrolling to do before the desired date appears. The dates are in desc order so December dates appear at the top of the list. However, the user will normally wish to select a date within the current month or the next month.
So ideally at any time of the year the user would like to have the current month displayed at the top of the cbo list to afford quick selection.
Any help on this would be much appreciated.
|
|
Reply By:
|
sal
|
Reply Date:
|
2/13/2004 11:46:12 PM
|
you can set the default value to the date you want.
Me.Combo1.DefaultValue = Date()
or something close to that.
Sal
|
|
Reply By:
|
DBoulos
|
Reply Date:
|
2/14/2004 4:02:16 PM
|
Hi AxeSess, I agree with Sal but, depending on which column is bound in your cbox & how it's formatted, will require a little more modification. I understand the training dates are not incremented day by day, thus, Date() may not correspond with a particular traing day...your cbox will not function correctly... If the trainingday cbobox is bound to a sql statement, then in the "order by " clause, make it equal current month. eg Dim iMonth as integer iMonth = Month(Date) OrderBy [cboTraingDay] = "Like 'iMonth/*/*'"
..at least you get the idea. Syntax may be off slightly, but the concept should be valid. Hope this helps, (obviously, I took a lot for granted).
|
|
Reply By:
|
AxeSess
|
Reply Date:
|
2/15/2004 5:48:27 AM
|
Thanks Sal and DBoulos
Sal reminded me that the simple solutions are often the best. DBoulos you are right on track in that the date is not the bound column in the cbo.
Have not done it yet (important football match to watch first) but I get the general idea of your suggestion and will attempt something along those lines.
Thanks to you both.
Murry
|