SubForm using Crosstab Query (Dynamic Column Problem) (1 Viewer)

KINGOFCHAOS17

Member
Local time
Today, 20:23
Joined
Mar 20, 2020
Messages
31
Hello all. I'm trying to create a subreport linked by field [CatalogID] from a crosstab query. The columns of the query are dynamic and I'm struggling to get the subreport to function correctly when the data changes in field [Year]. I've attached screenshots of the crosstab query and of the data it shows. Is anyone able to help me make the columns dynamic so they're not fixed to the initial years when I create the subreport? Thanks in advance.
 

Attachments

  • crosstab query data.png
    crosstab query data.png
    26.2 KB · Views: 91
  • crosstab query.png
    crosstab query.png
    14 KB · Views: 89

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:23
Joined
May 7, 2009
Messages
19,245
the report is Dynamic so you Set each Report Label and textbox controlsource dynamically through vba code.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:23
Joined
May 7, 2009
Messages
19,245
see the Open event of the report on this demo.
see also the report in design view.
 

Attachments

  • Crosstab_Dynamic_Report.accdb
    672 KB · Views: 135

KINGOFCHAOS17

Member
Local time
Today, 20:23
Joined
Mar 20, 2020
Messages
31
see the Open event of the report on this demo.
see also the report in design view.
Thank you, I've tried applying this to a Form, however having problems with the data fields showing an error. What am I doing wrong?
 

Attachments

  • Form Design View 1.png
    Form Design View 1.png
    20.4 KB · Views: 77
  • Form Design View 2.png
    Form Design View 2.png
    7.6 KB · Views: 83
  • Form Design View 3.png
    Form Design View 3.png
    9.5 KB · Views: 88
  • Form View.png
    Form View.png
    18.1 KB · Views: 83
  • 16263F64-4C1C-4A3A-B00F-E07CFD73F3C7.jpeg
    16263F64-4C1C-4A3A-B00F-E07CFD73F3C7.jpeg
    144.4 KB · Views: 83

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:23
Joined
May 7, 2009
Messages
19,245
I thought you want it in a Report/Subreport (post#1)?
 

KINGOFCHAOS17

Member
Local time
Today, 20:23
Joined
Mar 20, 2020
Messages
31
I thought you want it in a Report/Subreport (post#1)?
Oh wow, that’s totally my mistake, sorry. I’d been working on reports all week and had them on the mind. I’m this scenario/requirement it’s a subform.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:23
Joined
May 7, 2009
Messages
19,245
you can use the Subform's Source Object property to set it to your Query.
then it will take whatever column you have on that query.
see Form1.
view Child0 subform in design view.
 

Attachments

  • Crosstab_Dynamic_Report.accdb
    800 KB · Views: 137

KINGOFCHAOS17

Member
Local time
Today, 20:23
Joined
Mar 20, 2020
Messages
31
Thank you. I can't see any design details for the Child0 subform, I was hoping to replicate this process with other similar data.

I imported the subform Child0 into my form and tried linking on ID and CatalogID however I received the attached error. I can't see / don't understand what I'm doing wrong.
 

Attachments

  • Link Error.png
    Link Error.png
    6.2 KB · Views: 84

Users who are viewing this thread

Top Bottom