Dim nms As String Dim n As Integer = 6 '未来天数,含今天,所以实际是未来7天 For Each dr As DataRow In DataTables("对私客户明细").DataRows Dim dt As Date = dr("生日") Dim dt1 As Date Dim dt2 As Date If dt.Month = 2 AndAlso dt.Day = 29 Then dt1 = New Date(Date.Today.Year,dt.Month,28) dt2 = New Date(Date.Today.AddDays(n).Year,dt.Month,28) Else dt1 = New Date(Date.Today.Year,dt.Month,dt.Day) dt2 = New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day) End If If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then nms = nms & ",'" & dr("身份证号") & "'" End If Next If nms > "" Then nms = nms.Trim(",") Tables("对私客户明细").filter = "[身份证号] In (" & nms &")" End If
|