rs.open "select distinct left(考勤时间, 4) as kqyear from table order by 考勤时间", cn
do until rs.eof
combo1.additem rs!kqyear
rs.movenext
loop
if combo1.listcount then combo1.listindex = 0
另写一个过程:
Private Sub Combo1_Click()
rs.open "select distinct right(考勤时间, 2) as kpmonth from table order by right(考勤时间, 2)", cn
do until rs.eof
combo2.additem rs!kqmonth
rs.movenext
loop
if combo2.listcount then combo2.listindex = 0