Unbound Report

  • Thread starter Thread starter D B Lawson
  • Start date Start date
D

D B Lawson

Guest
I have a crosstab query that gives me dynamic results. Although the column headings (dates) change, the number of columns in the crosstab result are always the same (21). I have a report with 21 unbound fields and I've been trying to fill the report with the data from the crosstab query using code sampled from the Solutions dynamic report. The code keeps getting stuck at

Set rstReport = qdf.OpenRecordset()

and I don't understand why.

Because the number of columns in my crosstab query is static, is there another way I can fill my report?
 
I have taken a look at the solutions report that you are trying to imitate. This might seem redundant, but have you set your query definition ahead of this line. I'm only asking, because if the error is trapped on this line, then something is not set up correctly for it to continue, and it would seem as though its with your underlying query.
 
Hi Carol

Thanks for your reply. This is the first time I have done a dynamic report and I'm working a bit in the dark because none of the help files etc make much sense. The code I have on the On Open Event of the report is :
Dim intX As String
Dim qdf As DAO.QueryDef
Dim frm As Form
Dim rst As Report

' Set database variable to current database.
Set dbsReport = CurrentDb
Set qdf = dbsReport.QueryDefs("qryWorkscheduleCrosstab")

Set rstReport = qdf.OpenRecordset()

' Set a variable to hold number of columns in crosstab query.
intColumnCount = rstReport.Fields.Count


At Set rstReport = qdf.OpenRecordset() I get a Type Mismatch error.

My crosstab query is set up with a parameter that looks for any records for the current date and also the next fifteen working days. This seems to be working as it should and if I run the query I'm getting the results I want. Just can't seem to get them into a report.

Thanks again.

D
 

Users who are viewing this thread

Back
Top Bottom