Right! Figured this would be the next question ;-)
This situation can not go on indefinitely because you will
eventually run out of space on the form. So, you have to
decide on a maximum number of months to display on the form.
If, for example, you will always want one years worth of
data, you can prespecify the months by using the crosstab
query's Column Headings property.
If that won't meet your needs, then you should use an
expression for the field that's used for the column header
(Pivot) that makes the row heading a relative month number:
"M" & DateDiff("m", yourdatefield, Date())
which allows you to bind the form controls to the field
names M0, M1, ... If the form then uses a text box for the
heading labels, you can display the month names with sort of
the reversee expression
=Format(DateAdd("m", 0, Date()), "mmmm")
=Format(DateAdd("m", -1, Date()), "mmmm")
. . .
If none of that comes close to what you need, post back with
more detail about what you do need.
--
Marsh
MVP [MS Access]
It works with a tabular form.Thank You.
But now I have another problem.Since this form is generated by a crosstab
query and the fields are filtered months (>Date()),next month I will have the
field of January #Name? and the new months that I have added will not
appear.Is there a way to solve the problem? Thank You in advance