# Re: 如何使calendar元件的年月日，做为查询资料的变数

Posted by Alex on December 14, 1998 at 21:13:12:

In Reply to: 如何使calendar元件的年月日，做为查询资料的变数 posted by KK on December 05, 1998 at 14:39:14:

: 如何使calendar元件的年月日，做为查询资料的变数，如选择"十一月"，dbgrid 即列出当月的资料?
: Thanks a lot!

1.于Calendar1_Click事件中转换Calendar.value的月份出来,---->MonthVal=month(Calendar1.value).
2.再设定Data1.recordsource="Select 栏位 from 表单 where month(月份栏位)=MonthVal"
Data1.refresh

Follow Ups: