B
BB_MIT
Howdy folks, I'm looking for a little feedback on the following issue.
We have a fairly complex report that contains several sub-reports. Some of
the sub-reports are based upon crosstab queries that provide some aggregate
calculations. At present the crosstab queries utilize a "where" limiting
clause based upon a form's textbox value. While this method works fine it is
undesirable as the specific form must be open in order to use the report. We
would like to revise how the crosstab data is limited by using a variable
passed as a parameter if possible.
We have revised the "Open" event code in the sub-reports to create a
QueryDef object to which we are trying to assign a value to qdf.parameter(0).
Here is some sample code:
==========================================================
Set dbsReport = CurrentDb
'// Open QueryDef object.
Set qdf = dbsReport.QueryDefs("Rpt_Recap_Cont_Sub_Xtab_Qry")
'// Set parameters for query based on values from parent report
qdf.Parameters(0) = Reports![Recap]![Txt_Job_id]
'// Open Recordset object.
Set rstReport = qdf.OpenRecordset()
Me.RecordSource = rstReport.Name
'// Set a variable to hold number of columns in crosstab query.
intColumnCount = rstReport.Fields.Count
==========================================================
The crosstab query include a single parameter of the long integer type and
the SQL string includes a "where" that should limit returned data based upon
that value.
The problem is that when the report is used accessed the user is prompted
with an input box requesting parameter input for the crosstab query.
Obviously we want to eliminate this prompt and have the parameter value
passed to the crosstab queries programmatically.
Any help that could be provided would be greatly appreciated.
Cordially,
Bob
We have a fairly complex report that contains several sub-reports. Some of
the sub-reports are based upon crosstab queries that provide some aggregate
calculations. At present the crosstab queries utilize a "where" limiting
clause based upon a form's textbox value. While this method works fine it is
undesirable as the specific form must be open in order to use the report. We
would like to revise how the crosstab data is limited by using a variable
passed as a parameter if possible.
We have revised the "Open" event code in the sub-reports to create a
QueryDef object to which we are trying to assign a value to qdf.parameter(0).
Here is some sample code:
==========================================================
Set dbsReport = CurrentDb
'// Open QueryDef object.
Set qdf = dbsReport.QueryDefs("Rpt_Recap_Cont_Sub_Xtab_Qry")
'// Set parameters for query based on values from parent report
qdf.Parameters(0) = Reports![Recap]![Txt_Job_id]
'// Open Recordset object.
Set rstReport = qdf.OpenRecordset()
Me.RecordSource = rstReport.Name
'// Set a variable to hold number of columns in crosstab query.
intColumnCount = rstReport.Fields.Count
==========================================================
The crosstab query include a single parameter of the long integer type and
the SQL string includes a "where" that should limit returned data based upon
that value.
The problem is that when the report is used accessed the user is prompted
with an input box requesting parameter input for the crosstab query.
Obviously we want to eliminate this prompt and have the parameter value
passed to the crosstab queries programmatically.
Any help that could be provided would be greatly appreciated.
Cordially,
Bob