Date expression in Report Header

  • Thread starter Thread starter Gene Hora
  • Start date Start date
G

Gene Hora

In Access 97 in a report of groups birthdays for a particular month (usually
prepared a month in advance) I want the Report Header to show "Birthdays --
March 2003" (for example). The report itself has 3 columns -- First/Last
names and birthday. The birthday is shown only as "Mar 17" to avoid the
year. This was done in the source query as an separate expression on DOB.

I can't seem to get the expression correct to place the entire header in one
text box. I've used a clunky method of label for "Birthdays --" with 2
separate text boxes. 1st text box formats DOB to show only month, e.g.,
"March" -- 2nd text box formats current year to show "2003." Then all three
are aligned as much as possible, but problems occur with different length
months. My method seems very patchwork.
 
Gene said:
In Access 97 in a report of groups birthdays for a particular month (usually
prepared a month in advance) I want the Report Header to show "Birthdays --
March 2003" (for example). The report itself has 3 columns -- First/Last
names and birthday. The birthday is shown only as "Mar 17" to avoid the
year. This was done in the source query as an separate expression on DOB.

I can't seem to get the expression correct to place the entire header in one
text box. I've used a clunky method of label for "Birthdays --" with 2
separate text boxes. 1st text box formats DOB to show only month, e.g.,
"March" -- 2nd text box formats current year to show "2003." Then all three
are aligned as much as possible, but problems occur with different length
months. My method seems very patchwork.

Gene,
No labels.
I assume you are simply formatting the DOB field in the query, not
actually changing it's datatype to text.
The below code assumes DOB is retained as a valid date datatype.

Add an unbound text control to the header
Set it's control source to:

= "Birthdays for -- " & Format([DOB],"mmm") & " " & IIf(Month(DOB)=1
And Month(Date())<>1,Year(Date())+1,Year(Date()))

This should accurately place the month and year in the report header for
January birthdays, whether or not you run the report a month before or
during January.
 
Thanks so much for the rapid response; more than I could have expected.
Your advice worked absolutely perfectly -- beautiful!! I merely added an
additional "m" in order to spell out the month in the Header. I really
appreciate your help on this. If I wasn't so along in years I would take a
stab at learning some programming.

fredg said:
Gene said:
In Access 97 in a report of groups birthdays for a particular month (usually
prepared a month in advance) I want the Report Header to show "Birthdays --
March 2003" (for example). The report itself has 3 columns -- First/Last
names and birthday. The birthday is shown only as "Mar 17" to avoid the
year. This was done in the source query as an separate expression on DOB.

I can't seem to get the expression correct to place the entire header in one
text box. I've used a clunky method of label for "Birthdays --" with 2
separate text boxes. 1st text box formats DOB to show only month, e.g.,
"March" -- 2nd text box formats current year to show "2003." Then all three
are aligned as much as possible, but problems occur with different length
months. My method seems very patchwork.

Gene,
No labels.
I assume you are simply formatting the DOB field in the query, not
actually changing it's datatype to text.
The below code assumes DOB is retained as a valid date datatype.

Add an unbound text control to the header
Set it's control source to:

= "Birthdays for -- " & Format([DOB],"mmm") & " " & IIf(Month(DOB)=1
And Month(Date())<>1,Year(Date())+1,Year(Date()))

This should accurately place the month and year in the report header for
January birthdays, whether or not you run the report a month before or
during January.
 
Gene said:
Thanks so much for the rapid response; more than I could have expected.
Your advice worked absolutely perfectly -- beautiful!! I merely added an
additional "m" in order to spell out the month in the Header. I really
appreciate your help on this. If I wasn't so along in years I would take a
stab at learning some programming.

news:[email protected]...


Take the stab, Gene.
You'r probably not as far along as I am.
 
Back
Top