嗯嗯,确实是有点小毛病。
需要对输入的天数进行一下判断,溢出的,年份有两种情况。
Dim a As Integer=RibbonTabs("会员信息管理").Groups("生日提醒").Items("数值输入框1").value
Dim nms As String
For Each dr As DataRow In DataTables("会员档案").DataRows
Dim dt As Date = dr("客户生日")
Dim dt2 As Date
dt = New Date(Date.Today.Year, dt.Month,dt.Day)
dt2 = New Date(Date.Today.AddDays(a).Year, dt.Month, dt.Day)
If dt >= Date.Today AndAlso dt < Date.Today.AddDays(a) OrElse dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(a) Then
nms = nms & ",'" & dr("车牌号") & "'"
End If
Next
If nms > "" Then
nms = nms.Trim(",")
Tables("会员档案").filter = "[车牌号] In (" & nms &")"
Else
Tables("会员档案").filter = "[车牌号] =''"
messagebox.show("没有此期间过生日的客户!","提示")
End If