Dim yzrq As WinForm.DateTimePicker = e.Sender 'rq是日期控件
Dim d As Date = yzrq.Value
Dim dj As Date = yzrq.OldValue
Dim y As Integer = dj.Year
Dim m As Integer = dj.Month
Dim Days As Integer = Date.DaysInMonth(y,m)
Dim fd As Date = New Date(y,m,1) '获得该月的第一天
Dim ld As Date = New Date(y,m,Days) '获得该月的最后一天
Dim c As Integer = DataTables("缴费情况").SQLCompute("Count([车牌号码])","[单号] = '" & Forms("月租收费").Controls("dh").Value & "'")
If c > 0 Then
If d < fd Or d > ld Then
e.cancel = True '如果是,取消操作
MessageBox.Show("修改的日期不能超出已保存单号所属月份","提示")
End If
End If