Guest_imported
New member
- Jan 1, 1970
- 0
I'm trying to run a report from a form. The form has two field variables named [Beginning Date] and [Ending Date]. Clicking on a command button in the form runs a report which then runs a query to be used by the report. The code for the query is listed below:
Set Rs = Db.OpenRecordset("SELECT Count([Accident Data].[City or County]) AS City
FROM [Accident Data]
HAVING
((([Accident Data].Date) Between [forms]![Dates]![Beginning Date] And [forms]![Dates]![Ending Date])
AND (([Accident Data].[City or County])='City'))"
If Rs.RecordCount = 0 Then
Rs.Close
Db.Close
NumAcc = 0
End If
NumAcc = Rs!City
MsgBox "NumAcc = " & NumAcc
Rs.Close
I keep getting the error message:
Runtime Error '3061'
Too Few Parameters. Expected 2.
Help isn't much help.
Set Rs = Db.OpenRecordset("SELECT Count([Accident Data].[City or County]) AS City
FROM [Accident Data]
HAVING
((([Accident Data].Date) Between [forms]![Dates]![Beginning Date] And [forms]![Dates]![Ending Date])
AND (([Accident Data].[City or County])='City'))"
If Rs.RecordCount = 0 Then
Rs.Close
Db.Close
NumAcc = 0
End If
NumAcc = Rs!City
MsgBox "NumAcc = " & NumAcc
Rs.Close
I keep getting the error message:
Runtime Error '3061'
Too Few Parameters. Expected 2.
Help isn't much help.