In query design view:
== In an empty "cell" on the field row enter
HappyHappy: DateSerial(Year(Date()), Month([Date_Of_Birth]),
Day([Date_Of_Birth]))
== You can uncheck the Show button for this field
== Enter in the criteria cell under this calculated field
BETWEEN DateSerial(Year(Date()), Month(Date()), 1) AND
DateSerial(Year(Date()), Month(Date()) + 1, 0)
Another way to handle this for any one month
== In an empty "cell" on the field row enter
HappyHappy: Month([Date_Of_Birth])
== You can uncheck the Show button for this field
== Enter in the criteria cell under this calculated field, the number of the
month you want data returned on. For instance, 12 for December.
In both the above cases you will have to select which fields you want to
display in the results.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
John,
Thanks for your reply. I'm afraid I lack some of the sophistication that,
I'm ashamed to say, hasn't come my way yet. I used to use dBase, way back
when, but a lot has changed.
When you say to put the expression in an "empty field cell", you mean
somewhere to the right of the data I have in my table, right?
And should this expression exist in each record?
I assume that "HappyHappy" is what I would call a variable elsewhere. Also
right?
Thanks.
John W. Vinson said:
On Wed, 2 Dec 2009 13:45:01 -0800, PlarfySoober
I have a table with employees' names. I need to show birthdays (and hire
dates) somehow for the current or a subsequent month.
1. Is this best done by a query or by a report?
2. If by a query, I have tried Month: Format([Date_of_Birth],"mm")
in a separate column but get a "Data type mismatch" error.
The Date_of_Birth column is a date/time field.
My query has last_name, first_name and Date_of_Birth fields, and the above.
Thanks.
The simplest way is to calculate this year's birthday anniversary. In a vacant
Field cell put
HappyHappy: DateSerial(Year(Date()), Month([Date_Of_Birth]),
Day([Date_Of_Birth]))
You can then use a criterion on this field such as
BETWEEN DateSerial(Year(Date()), Month(Date()), 1) AND
DateSerial(Year(Date()), Month(Date()) + 1, 0)
to find this month's birthdays; you can sort by it, put other criteria on it,
etc.
.