Here's what I have - I have one report (Final) which contains 2 subreports.
Subreport1: lists a record: Name, Event, Days (one type)
Subreport2: lists a record: Name, Event, Days (another query)
On the Final report, I need to display the count of each different event from the subreports. I have written an SQL Sub in the Final Report (On Open event). But, it gives me an error ("Runtime Error 3061: too few parameters. Expected 2."
and highlights the line: Set rstQry = dbs.OpenRecordset("qryRptFacPtsSubOne"
. But I can't figure out what else I need. I have written these types of SQL cases and have done it this ways each time. Here's the code in the report:
........
Dim strEvent As String
Dim dbs As Database
Dim rstQry As Recordset......
Set dbs = CurrentDb
Set rstQry = dbs.OpenRecordset("qryRptFacPtsSubOne"
With rstQry
rstQry.MoveFirst
Do While Not rstQry.EOF
strEvent = rstQry!EventCode
' Set lookup variables to count events
Select Case strEvent
Case "2"
TwoCount = TwoCount + 1
..........
Case Else
'error
End Select
rstQry.MoveNext
Loop
End With
Me!EventTwo = TwoCount.....
End Sub
The query it is referencing does have one field that is based off of a lengthy if/else, but it has no problems running by itself - no errors. Any suggestions? "Try everything at least once."
Subreport1: lists a record: Name, Event, Days (one type)
Subreport2: lists a record: Name, Event, Days (another query)
On the Final report, I need to display the count of each different event from the subreports. I have written an SQL Sub in the Final Report (On Open event). But, it gives me an error ("Runtime Error 3061: too few parameters. Expected 2."
........
Dim strEvent As String
Dim dbs As Database
Dim rstQry As Recordset......
Set dbs = CurrentDb
Set rstQry = dbs.OpenRecordset("qryRptFacPtsSubOne"
With rstQry
rstQry.MoveFirst
Do While Not rstQry.EOF
strEvent = rstQry!EventCode
' Set lookup variables to count events
Select Case strEvent
Case "2"
TwoCount = TwoCount + 1
..........
Case Else
'error
End Select
rstQry.MoveNext
Loop
End With
Me!EventTwo = TwoCount.....
End Sub
The query it is referencing does have one field that is based off of a lengthy if/else, but it has no problems running by itself - no errors. Any suggestions? "Try everything at least once."