S
Steve
Hi,
I am trying to use an SQL statement in code to get a count
from a query. When the code runs, i am getting the error
3061 - Too Few parameters. Expected 1
The Code is;
Dim strQ_Type As String
strQ_Type = Forms!frmWorkflow!cmbQueue_List
Get_Counts:
Set db = CurrentDb
Set tmpRst = db.OpenRecordset("SELECT Filter_Name,
Filter_Query FROM tblQueue_Filters WHERE Queue_Type
Like '*" & strQ_Type & "*' ORDER BY Filter_Sort_Order;")
Do Until tmpRst.EOF
' Now to get a count of MPR's within each Queue.
Set rstSQL = db.OpenRecordset("SELECT Count(MPR)
AS CountofMPR FROM " & tmpRst("Filter_Query") & ";")
Next_Query:
tmpRst.MoveNext
Loop
Exit Sub
The error turns up on the set rstSQL line. The query in
the record tmpRst("Filter_Query") does have a parameter
value in it (it relates to a list box on a form), but I do
not know how to overcome the problem.
Can anyone help?
Many thanks in anticipation,
Steve.
I am trying to use an SQL statement in code to get a count
from a query. When the code runs, i am getting the error
3061 - Too Few parameters. Expected 1
The Code is;
Dim strQ_Type As String
strQ_Type = Forms!frmWorkflow!cmbQueue_List
Get_Counts:
Set db = CurrentDb
Set tmpRst = db.OpenRecordset("SELECT Filter_Name,
Filter_Query FROM tblQueue_Filters WHERE Queue_Type
Like '*" & strQ_Type & "*' ORDER BY Filter_Sort_Order;")
Do Until tmpRst.EOF
' Now to get a count of MPR's within each Queue.
Set rstSQL = db.OpenRecordset("SELECT Count(MPR)
AS CountofMPR FROM " & tmpRst("Filter_Query") & ";")
Next_Query:
tmpRst.MoveNext
Loop
Exit Sub
The error turns up on the set rstSQL line. The query in
the record tmpRst("Filter_Query") does have a parameter
value in it (it relates to a list box on a form), but I do
not know how to overcome the problem.
Can anyone help?
Many thanks in anticipation,
Steve.