Peter Bailey wrote:
Thanks to the news group I can now clear a list box. The default value in
properties of the combo is set to "please select a year".
the code Me.CBDOSYear = Me.CBDOSYear.It emData(0)
however this relates to the first year in the list, itried -1 to get it back
to the default value how do I do that as -1 didnt work
regards in advance
Sometimes what I'll do is create a column value in the query/rowsource
to sort on...plus hide by setting the column width to 0 for it. So in a
row I would have a column equal to 0 for "please select a year" and 1
(or 2003) for 2003 and 2 (or 2004) for 2004. If you have such a scheme,
this would float to the top and your ItemData(0) line would work.
Is "please select a year" at the bottom of the list? If you know the
Index value of "please select a year", the your default needs to point
to that index value, not 0. You could get that with ListCount() minus
1. Ex:
Me.CBDOSYear = Me.CBDOSYear.It emData(Me.CBDOS Year.ListCount -1)
I can also check to see if that column is 0 or a value number.