I have couple of queries. Each does some calculations with data and then serves as a source for next.
And final one I need as a recordsource in some VBA code. But I keep getting error 3061: Too few parameters. Expected 1. No matter what I do. First I tried to use saved query simply as a recordsource. Same Error. Then I tried to copy code from saved query directly in to VBA... still same error.
Interesting is, that I can always easily open all queries on their own without any error.
At the moment my part of code that produces error is (SQL from originaly saved query is now in string and used directly in VBA):
CODE
Dim dbsAnterosHermes As DAO.Database
Dim rsPosodobiUrnik As DAO.Recordset
Dim sqlKveri As String
Set dbsAnterosHermes = currentDB
sqlKveri = "SELECT sqlUnionOBISK_URNIK_MOZNOSTI.[DATUM], sqlUnionOBISK_URNIK_MOZNOSTI.[URA], Count(sqlUnionOBISK_URNIK_MOZNOSTI.[URA]) AS [ZasedeniTermini] " & _
"FROM sqlUnionOBISK_URNIK_MOZNOSTI " & _
"GROUP BY sqlUnionOBISK_URNIK_MOZNOSTI.[DATUM], sqlUnionOBISK_URNIK_MOZNOSTI.[URA] " & _
"ORDER BY sqlUnionOBISK_URNIK_MOZNOSTI.[DATUM], sqlUnionOBISK_URNIK_MOZNOSTI.[URA] "
Set rsPosodobiUrnik = dbsAnterosHermes.OpenRecordset(sqlKveri)
Dim rsPosodobiUrnik As DAO.Recordset
Dim sqlKveri As String
Set dbsAnterosHermes = currentDB
sqlKveri = "SELECT sqlUnionOBISK_URNIK_MOZNOSTI.[DATUM], sqlUnionOBISK_URNIK_MOZNOSTI.[URA], Count(sqlUnionOBISK_URNIK_MOZNOSTI.[URA]) AS [ZasedeniTermini] " & _
"FROM sqlUnionOBISK_URNIK_MOZNOSTI " & _
"GROUP BY sqlUnionOBISK_URNIK_MOZNOSTI.[DATUM], sqlUnionOBISK_URNIK_MOZNOSTI.[URA] " & _
"ORDER BY sqlUnionOBISK_URNIK_MOZNOSTI.[DATUM], sqlUnionOBISK_URNIK_MOZNOSTI.[URA] "
Set rsPosodobiUrnik = dbsAnterosHermes.OpenRecordset(sqlKveri)
Does anybody see any mistake? What could be wrong? Any suggestion, please... I'm going crazy here