I have to create a report that will compare values from different years. The record source for the report is set on a query that will return the value for each company for the latest selected year that the user selects on a form. For the other years, I created different queries to run and I am try to assign the values to the other columns.
First of all, why can’t I use the RunSQL command on a SELECT query? I had to change it to this but I don’t think it is what I need.
DoCmd.OpenQuery "AuditPTEChangesQuery1"
DoCmd.OpenQuery "AuditPTEChangesQuery2"
DoCmd.OpenQuery "AuditPTEChangesQuery3"
DoCmd.OpenQuery "AuditPTEChangesQuery4"
Second, It will not let me assign the query values to my report columns (I get a 80020009 error)
Any suggestions on how to solve my problem would be greatly appriciated.
Thank you in advance.
RunSQL is for action queries. A select query has nothing to run. If you wish to display data in a report from tables or queries other than the bound recordset, you can use a recordset and VBA, a subreport, a domain aggregate function or you can refer to an open form.