This little bit of code is filling page header text boxes in a report with data from crosstab headers - its in the PageHeaderSection_Format section.
what I'm looking to do is format these text boxes as mmm-yy - they are dates in the format dd/mm/yy at the moment. I've added the code below ('for intx = 2' because the first column heading isn't a date) and it works
but....
Ideally I would like the code to test if the value is a date and if it is set it to mmm-yy, also ideally in that same first bit of code where the headers are added to save a bit of time as the report creation is pretty slow already.
I want to be able to use this for other queries where the column headings may not be dates without having to alter the code.
jim
Code:
For intX = 1 To intColumnCount
Me("Head" + Format$(intX)) = rstReport(intX - 1).Name
Next intX
what I'm looking to do is format these text boxes as mmm-yy - they are dates in the format dd/mm/yy at the moment. I've added the code below ('for intx = 2' because the first column heading isn't a date) and it works

Code:
For intX = 2 To intColumnCount
Me("Head" + Format$(intX)) = Format(Me("Head" + Format$(intX)), "mmm-yy")
Next intX
Ideally I would like the code to test if the value is a date and if it is set it to mmm-yy, also ideally in that same first bit of code where the headers are added to save a bit of time as the report creation is pretty slow already.
I want to be able to use this for other queries where the column headings may not be dates without having to alter the code.
jim