Dim Filter As String With e.Form.Controls("Time") If .Value IsNot Nothing Then Dim dt As Date = .value Dim dt1 As Date = new Date(dt.year,dt.month,1) Dim dt2 As Date = dt1.AddMonths(1).AddDays(-1) If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "rq >= #" & dt1 & "# And rq <= #" & dt2 & "#" End If End With