I am an MS Access beginner using version 2013. A button opens a continuous form that I would like to filter for records in the range of ten days before the current date and 30 days after the current date (i.e. a 40-day period). I have tried various pieces of code for the button's on-click event, including the following, but just cannot get it to work.
DoCmd.OpenForm " Form_Projects", , , "Date= Between Date()-10 And Date()+30"
The expression Between Date()-10 And Date()+30 works fine in queries, but not in VBA, as I keep getting an error message telling me the code structure is wrong. Could anyone help point me in the direction of the correct VBA expression that should be used ?
DoCmd.OpenForm " Form_Projects", , , "[Date] >= "#" & Date()-10 & "#" And [Date] <= "#" & Date()+30 &"#""