以下是引用有点甜在2015-1-7 10:59:00的发言:
Dim d1 As Date = "2012-9-1"
Dim d2 As Date = "2010-9-1"
Dim n As Integer = 30 '未来30天
Dim idxs As String = ""
For Each dr As DataRow In DataTables("表A").Select("上牌日期 is not null")
Dim dt As Date = dr("上牌日期")
Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day)
Dim dt2 As New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day)
If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then
If dt >= d1 Then
Dim y As Integer = dt.Year - d1.Year
If y = 2 OrElse y = 4 OrElse y >= 6 Then
idxs &= dr("_Identify") & ","
End If
Else If dt > d2 AndAlso dt < d1 Then
Dim y As Integer = dt.Year - d1.Year
If y > 0 AndAlso y Mod 2 = 0 OrElse dt2.Year >= 2016 Then
idxs &= dr("_Identify") & ","
End If
Else If dt < d2 Then
Dim y As Integer = dt.Year - d1.Year
If dt2.Year >= 2016 Then
idxs &= dr("_Identify") & ","
End If
End If
End If
Next
Tables("表A").Filter = "_Identify in (" & idxs.trim(",") & ")"
老大。。这段代码跳出

此主题相关图片如下:qq截图20150108110901.jpg

错误!求助!