Hi, I have the following code:
Code:
Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
Dim rstClientGroup As DAO.Recordset, qryCount As QueryDef, strSQL As String
Set qryCount = CurrentDB.CreateQueryDef("")
With qryCount
strSQL = "SELECT Program, Count(ClientNum) AS CountOfClientNum FROM qryClientGroupSub " _
& "WHERE (((Program) = [rptAnnualTotalContactsByProg].[Program])) " _
& "GROUP BY Program"
.SQL = strSQL
Set rstClientGroup = .OpenRecordset(dbOpenDynaset)
With rstClientGroup
.MoveFirst
Me.CountOfClientNum = !CountOfClientNum
.Close
End With
.Close
End With
End Sub
It breaks with a run-time error on this line:
Code:
Set rstClientGroup = .OpenRecordset(dbOpenDynaset)
The code is supposed to run during the report, where the code is in a group footer (not the report footer).
The Access error message is "Too few parameters. Expected 2." What's wrong with the code?
Thanks for the help,
Sam