Hi June7
Thanks for the continued support.
This is the error I get!!
Run-time error ‘3075’
Syntax error (missing operator) in query expression ‘Year([ChequeDate])=’
Here is my full code:
Code:
Private Sub Command52_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT DISTINCT Year([ChequeDate]) AS Yr FROM tblIBISSheets;")
rs.MoveFirst
While Not rs.EOF
DoCmd.OpenReport "rptTest", acViewReport, , "Year([ChequeDate])=" & rs!Yr
DoCmd.Close acReport, "report name", acSaveNo
rs.MoveNext
Wend
End Sub
I have it triggered from a test button for now, hence the "Command52_Click()". I have all tables, reports etc spelled correct.
Thanks
Craig