Filter Recordset By Year

  • Hi,


    Does anyone know a more efficient way of filtering a date field of a recordset by year instead of specific dates? For example, instead of a combersome method like this:


    Code
    rsRecordSet.Filter = "StartDate >= #1/1/1995# AND StartDate <= #12/31/1995#"


    is there a better way of filtering records that have the StartDate in 1995?


    Thanks,


    Tom

  • Re: Filter Recordset By Year


    Quote from Mavyak

    Perhaps the following?


    Code
    rsRecordSet.Filter = "Year(StartDate) = 1995"



    i'm don't think that would work?


    your could add a parameter and string it in your code like this...


    Code
    Dim str as string
    rsRecordSet.Filter = "StartDate >= #1/1/" & "str" & " # AND StartDate <= #12/31/" & "str" & "#"


    HTH


    z

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!