先贴上代码Dim nms As String
For Each dr As DataRow In DataTables("会员信息表").DataRows
Dim dt As Date = dr("生日_公历_叔叔")
Dim bt As Date = dr("生日_公历_阿姨")
If (dt.Month >= e.form.Controls("TextBox1").text AndAlso dt.month < e.form.Controls("TextBox2").text) OrElse (bt.Month >= e.form.Controls("TextBox1").text AndAlso bt.month < e.form.Controls("TextBox2").text) Then
nms = nms & ",'" & dr("永久编号") & "'"
End If
Next
If nms > "" Then
nms = nms.Trim(",")
Dim flt As String = Tables("会员信息表").Filter
flt = iif(flt > "", "(" & flt & ")", "1=1")
Tables("会员信息表").Filter = flt & " and [永久编号] In (" & nms &")"
Else
Tables("会员信息表").filter = "[永久编号] = 0 "
End If
由于日期空值并非为0,所以以上代码,在日期为空值时,依旧能返回月份1,导致筛选1月份生日的时候,筛选不出来,如何修改才能精准的筛选出1月份生日?