My goal for a group header on a report is to have a header for each month of the year based on a date field within the header. Example:
January
4th
6th
13th
Febuary
5th
23rd
...ect.
(Both the date field and the unbound textbox are in the group header, but the date field is set to .visible=no)
I really think I need this unbound textbox in some way referencing the date field within the header so that if no dates for a given month appear in the underlying query, then the month won't appear on the report. Here is how I've gone about doing this:
Within the query I have created a field with the expression Format((date),"mm"
where date is my date field with the format mm/dd/yyyy. This query returns the desired values (01, 02, 03, etc). I then have code for the report in the detail_format section as follows:
If me.text1="01" then
me.text2="January"
ElseIf me.text1="02" then
me.text2="February"
...etc. (where text1 controlsource is the expression from the query and text2 is the unbound textbox).
Believe it or not this works fine, only the appropriate values on the report are one group header off. For instance, if the date field in the first group is January, then there is text2 is blank. Regardless of what the next groups date field is, January shows up in text2. It's as if all of the text2 fields are one group level behind. Any suggestions on why this is happening? Also, if there is a way of calculating this within my query so that I can simply drag this calculated field into my report, I would like to know that too. If at all possible, I would like information or ideas regarding both of these potential answers as this may help my avoid problems in the future with grouping on a report. Thanks in advance!!
January
4th
6th
13th
Febuary
5th
23rd
...ect.
(Both the date field and the unbound textbox are in the group header, but the date field is set to .visible=no)
I really think I need this unbound textbox in some way referencing the date field within the header so that if no dates for a given month appear in the underlying query, then the month won't appear on the report. Here is how I've gone about doing this:
Within the query I have created a field with the expression Format((date),"mm"
If me.text1="01" then
me.text2="January"
ElseIf me.text1="02" then
me.text2="February"
...etc. (where text1 controlsource is the expression from the query and text2 is the unbound textbox).
Believe it or not this works fine, only the appropriate values on the report are one group header off. For instance, if the date field in the first group is January, then there is text2 is blank. Regardless of what the next groups date field is, January shows up in text2. It's as if all of the text2 fields are one group level behind. Any suggestions on why this is happening? Also, if there is a way of calculating this within my query so that I can simply drag this calculated field into my report, I would like to know that too. If at all possible, I would like information or ideas regarding both of these potential answers as this may help my avoid problems in the future with grouping on a report. Thanks in advance!!