Hello,
I am trying to run a query through vba module in ACCESS 2003 but I get runtime error 2342: “A Run SQL action requires an argument consisting of an SQL statement”. I am not sure why I am getting this error.
This is to code I have written:
I would appreciate if someone tell me where I am going wrong.
Thanks for the help
Peace
I am trying to run a query through vba module in ACCESS 2003 but I get runtime error 2342: “A Run SQL action requires an argument consisting of an SQL statement”. I am not sure why I am getting this error.
This is to code I have written:
Code:
Set db = CurrentDb
Set qdf = db.CreateQueryDef("qryMS_TNA_Ser1")
strSelect = "[Historical Nav Data].FundNumber, [Historical Nav Data].Class, Sum([Historical Nav Data].MarketValue) AS SumOfMarketValue, Sum([Historical Nav Data].NetCash) AS SumOfNetCash, Sum([MarketValue]+[NetCash]) AS [Total TNA]"
strFrom = "[Historical Nav Data]"
strWhere = " ((([Historical Nav Data].PricingDate) = #3/10/2008#)) "
strGroup = "[Historical Nav Data].FundNumber, [Historical Nav Data].Class"
strHaving = "((([Historical Nav Data].Class)=""A""));"
strSQL = "SELECT " & strSelect & " FROM " & strFrom & " WHERE " & strWhere & "GROUP BY" & strGroup & "HAVING" & strHaving
DoCmd.RunSQL strSQL
I would appreciate if someone tell me where I am going wrong.
Thanks for the help
Peace