Problem : Runtime error ‘3061’: Too few Parameters. Expected 3
[qryEditNewSummary] is a Query, If change the [qryEditNewSummary] to a “Table” , It work ok, no error. but if change to any Query, it will have runtime error 3601.
I have check the query name, and field name, everything is ok.
What ‘s wrong with query in dao??
1: 2: 3: 4: 5: 6: 7: 8: |
Private Sub cmdRandom_Click() Dim dbs As Database Dim rst As Recordset Set dbs = CurrentDb strSQL = "Select Total From [qryEditNewSummary]" Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset) MsgBox rst!Total End Sub |
Solution : Runtime error ‘3061’: Too few Parameters. Expected 3
A very common cause of this error is Form References in a query.
For example, if your query looks like this:
SELECT *
FROM YourTable
WHERE YourField = Forms!YourForm!YourTextbox
This query will work perfectly when run from the database window. However, the reference to the form control will cause the “Too Few Parameters” Error if that same query is called from VBA.
To resolve this, all form references must be evaluated seperately from the query.
To help you further with this, we would need to see the SQL for qryEditNewSummary.