July 26th, 2013, 10:55 AM
Retrieve all records for 5 mths from now regardless of year
The following code works to bring back records from an Access2007 database that have a renewal month 5 months from current month. I would like to further delineate by year? I want only records 5 months from current date or, December of 2013. When I run next month it would be for January of 2014 etc... It currently brings back all renewal dates in December regardless of year, for example December of 2022. Thanks so much for the help.
rs.Open "SELECT * Owners INNER JOIN Renewal ON Owners.Owner = Renewal.Comp " _
& "WHERE Owners.FOorSA = 'FO' And " _
& "DatePart(""m"", Renewal.RenewalDte) = DatePart(""m"", NOW) + 5", Conn, adOpenStatic, adLockOptimistic
Click Here to Expand Forum to Full Width