Goodmorning,
I've got a query where some fields are the result of a subquery. The query that causes me trouble is:
The problem resides in the ORDER BY clause. It seems impossible to sort on the field [TypeOption], or [Moeder]. The system gives the following error:
runtime error 3061: Two few parameters. Expected 1
When I replace [TypeOption] with [Holding] the sorting clause works fine. Perhaps someone can tell me what I am doing wrong or answer one of my questions:
Q: is it impossible to sort on a field that is the result of a subquery (i.e. Moeder, OptExcer)?
Q: is it impossible to sort on a field that is the result of a VBA function (i.e. TypeOption)?
Any help appreciated!
Regards, Karja
I've got a query where some fields are the result of a subquery. The query that causes me trouble is:
Code:
SQLs = "SELECT SecurityCode, Holding, iif([TypeSubCode] Like '161*', 0, 1) As TypeOption, " & _
"(SELECT Value FROM G_MarketData_BB WHERE G_MarketData_GP.Bloomberg = G_MarketData_BB.SecurityCode AND TypeOfData = 'OptExcer') As OptExcer, " & _
"(SELECT Value FROM G_MarketData_BB WHERE G_MarketData_GP.Bloomberg = G_MarketData_BB.SecurityCode AND TypeOfData = 'Moeder') As Moeder " & _
"FROM G_MarketData_GP " & _
"WHERE [FundCode] = " & codeFonds & " AND [G_MarketData_GP.Date] = #" & Format(dateHisinv, "yyyy-mm-dd") & "# AND " & _
"[Type] = 'OPTI' AND [Holding] < 0 " & _
"ORDER BY TypeOption;"
Set rsShort = CurrentDb.OpenRecordset(SQLs)
The problem resides in the ORDER BY clause. It seems impossible to sort on the field [TypeOption], or [Moeder]. The system gives the following error:
runtime error 3061: Two few parameters. Expected 1
When I replace [TypeOption] with [Holding] the sorting clause works fine. Perhaps someone can tell me what I am doing wrong or answer one of my questions:
Q: is it impossible to sort on a field that is the result of a subquery (i.e. Moeder, OptExcer)?
Q: is it impossible to sort on a field that is the result of a VBA function (i.e. TypeOption)?
Any help appreciated!
Regards, Karja