Crosstab Query for Report with Variable Dates (1 Viewer)

Malcolm17

Member
Local time
Today, 07:54
Joined
Jun 11, 2018
Messages
39
Hi,

I have a database which I am looking to use a crosstab query which will populate the data for a report. The report data (column headings) will be products and dates which the user can select from a form, so the column headings will change depending upon the date range selected (max 7). I have uploaded an example with sample data I have used fixed dates (not from the form) for this example, however my issues is that I cannot work out how to get the query to change the date column headings (which could be any date) to pull through to my report on fixed headings if this is how it would be done.

I'm sure I have achieved this a few years ago, however cannot remember or see how to do this now.

Many thanks in advance for your help!!

Malcolm
 

Attachments

  • Example.accdb
    1.6 MB · Views: 19

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:54
Joined
Oct 29, 2018
Messages
13,202
Hi. You can either use VBA to dynamically adjust your report headings, or you can use a "staging" query to predefine the columns for your crosstab query. Just a thought...
 

Malcolm17

Member
Local time
Today, 07:54
Joined
Jun 11, 2018
Messages
39
Hi theDBguy,

I think I may have done it with a staging query before. Do you have any example of how I would do this using VBA please?
 

Malcolm17

Member
Local time
Today, 07:54
Joined
Jun 11, 2018
Messages
39
Hi, I cannot find your example using the download link on your link, I'm assuming that it is somewhere on the Microsoft website?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:54
Joined
Oct 29, 2018
Messages
13,202
Hi, I cannot find your example using the download link on your link, I'm assuming that it is somewhere on the Microsoft website?
Sorry about that. Let me check...
 

Users who are viewing this thread

Top Bottom