SubForm using Crosstab Query (Dynamic Column Problem)

KINGOFCHAOS17

Member
Local time
Today, 07:00
Joined
Mar 20, 2020
Messages
34
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: 128
  • crosstab query.png
    crosstab query.png
    14 KB · Views: 123
the report is Dynamic so you Set each Report Label and textbox controlsource dynamically through vba code.
 
see the Open event of the report on this demo.
see also the report in design view.
 

Attachments

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: 115
  • Form Design View 2.png
    Form Design View 2.png
    7.6 KB · Views: 124
  • Form Design View 3.png
    Form Design View 3.png
    9.5 KB · Views: 119
  • Form View.png
    Form View.png
    18.1 KB · Views: 121
  • 16263F64-4C1C-4A3A-B00F-E07CFD73F3C7.jpeg
    16263F64-4C1C-4A3A-B00F-E07CFD73F3C7.jpeg
    144.4 KB · Views: 114
I thought you want it in a Report/Subreport (post#1)?
 
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.
 
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

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: 115

Users who are viewing this thread

Back
Top Bottom