G
Guest
I have report that summaizes rolling periods. It is based on a Crosstab
query, but some label captions and rowsource properties of fields change as
the column headings potentially change each time the report is run.
So I am using DAO statements on the Open event of the report to retrieve the
field names from the crosstab query and assign them to the control source
property of the appropriate fields with:
Me.Q8.ControlSource = CurrentDb.QueryDefs("Z1").Fields(5).Name
(Z1 is the name of the query)
I use similar statements on the format property of a groupheader as well.
This works great until I add a parameter to the crosstab query. I get the
run-time error '3265' Item not found in this collection error. Do I have to
use openrecordset and retrieve the field names? If so, Can I use:
Currentdb.OpenRecordset("Z1") somehow when a parameter is required, or do I
have to provide the SQL string itself, define the parameter value, put it in
the string, etc.? Then get the field names and run the report and allow the
report query to pull the parameters from an open form? If so, can anyone
send an example?
Or Is there an easier way?
Thanks in advance.
query, but some label captions and rowsource properties of fields change as
the column headings potentially change each time the report is run.
So I am using DAO statements on the Open event of the report to retrieve the
field names from the crosstab query and assign them to the control source
property of the appropriate fields with:
Me.Q8.ControlSource = CurrentDb.QueryDefs("Z1").Fields(5).Name
(Z1 is the name of the query)
I use similar statements on the format property of a groupheader as well.
This works great until I add a parameter to the crosstab query. I get the
run-time error '3265' Item not found in this collection error. Do I have to
use openrecordset and retrieve the field names? If so, Can I use:
Currentdb.OpenRecordset("Z1") somehow when a parameter is required, or do I
have to provide the SQL string itself, define the parameter value, put it in
the string, etc.? Then get the field names and run the report and allow the
report query to pull the parameters from an open form? If so, can anyone
send an example?
Or Is there an easier way?
Thanks in advance.