Jan 15, 2021 #1 Moss100 Technical User Joined Aug 10, 2004 Messages 586 Location GB Can someone help me with the following, which is not working for me. Thank you Mark Code: Me.Form.Filter = [Ten_Lease_Start_Date] < DateAdd("yyyy", -6, Int(Now()))
Can someone help me with the following, which is not working for me. Thank you Mark Code: Me.Form.Filter = [Ten_Lease_Start_Date] < DateAdd("yyyy", -6, Int(Now()))
Jan 15, 2021 #2 dhookom Programmer Joined Jun 24, 2003 Messages 22,561 Location US What makes you think it's not working? Have you tried just Date() in place of Int(Now())? Duane Minnesota Hook'D on Access MS Access MVP 2001-2016 Upvote 0 Downvote
What makes you think it's not working? Have you tried just Date() in place of Int(Now())? Duane Minnesota Hook'D on Access MS Access MVP 2001-2016
Jan 15, 2021 #3 combo Technical User Joined Jan 1, 2003 Messages 4,197 Location PL The code sets True/False to Filter, a string should be instead: Me.Form.Filter = "[Ten_Lease_Start_Date] < " & DateAdd("yyyy", -6, Date()) combo Upvote 0 Downvote
The code sets True/False to Filter, a string should be instead: Me.Form.Filter = "[Ten_Lease_Start_Date] < " & DateAdd("yyyy", -6, Date()) combo
Jan 19, 2021 #4 Andrzejek Programmer Joined Jan 10, 2006 Messages 8,576 Location US I my opinion, the safest way to do it is: Code: Dim strFilter As String ... strFilter = "Ten_Lease_Start_Date < " & DateAdd("yyyy", -6, Date()) Debug.Print strFilter Me.Form.Filter = strFilter So you can actually SEE your filter before you apply it. BTW, you do not need [] around your field's name if you do not use spaces or reserved words in your fields' names. ---- Andy "Hmm...they have the internet on computers now"--Homer Simpson Upvote 0 Downvote
I my opinion, the safest way to do it is: Code: Dim strFilter As String ... strFilter = "Ten_Lease_Start_Date < " & DateAdd("yyyy", -6, Date()) Debug.Print strFilter Me.Form.Filter = strFilter So you can actually SEE your filter before you apply it. BTW, you do not need [] around your field's name if you do not use spaces or reserved words in your fields' names. ---- Andy "Hmm...they have the internet on computers now"--Homer Simpson