Hi guys, been searching all over the net and simply cannot work out how to do this. I have a while loop that I am running in order to open/print reports based on a filter.
My loop looks through a query I've set up using a Recordset and is supposed to take the values and use them as a report filter so that each unique value opens/prints its own report.
Here is the snippet where I am running into problems:
Code:
Dim ProjectCode As String
ProjectCode = rs.Fields("PROJECTPHASE")
'takes relevant query field data to generate report for each desired PROJECTPHASE. ProjectCode is set up to change the PROJECTPHASE for each loop (so reports are opened for each unique PROJECTPHASE)
DoCmd.OpenReport "MyReport", acViewReport, "", "[Staff_w_query2]![PROJECTPHASE]='ProjectCode'", acNormal
'filter the report by the correct PROJECTPHASE as developed above
.MoveNext
'move onto next ProjectCode
The above syntax doesn't actually assign the new ProjectCode for each loop.
Would be extremely grateful if anyone could point me in the right direction - seems like a simple fix but I'm new to all of this.
Thanks!