By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,653 Members | 1,847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,653 IT Pros & Developers. It's quick & easy.

Birthday in a query?

P: n/a
Hi, i did a search and find the way to get the birthday without the
year.

My field is yyyy/mm/dd, (birthday). I also have a day field (1 to 31)
and a month field. (1 to 12)

My problem is: I can get the birthday for one month in particular, but
i would like to be able to get birthday for a week that goes over 2
month.

ie: The last week of february 2006.
Sunday is february 26th and Saturday is march fourth. So far nothing
seems to work.

I would like to have something like this : Between [first date: mm/dd]
and [second date: mm/dd].

I cant put this in my birthday field because of the year (i think), i
did try a [Month]/[Day] field but it doesnt work.

any idea???

thx.

Feb 17 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
No***********@hotmail.com wrote:
Hi, i did a search and find the way to get the birthday without the
year.

My field is yyyy/mm/dd, (birthday). I also have a day field (1 to 31)
and a month field. (1 to 12)

My problem is: I can get the birthday for one month in particular, but
i would like to be able to get birthday for a week that goes over 2
month.

ie: The last week of february 2006.
Sunday is february 26th and Saturday is march fourth. So far nothing
seems to work.

I would like to have something like this : Between [first date: mm/dd]
and [second date: mm/dd].

I cant put this in my birthday field because of the year (i think), i
did try a [Month]/[Day] field but it doesnt work.

any idea???

thx.

? datePart("yyyy",Date)
2006
? datePart("m",Date)
2
? datePart("d",Date)
17
? Month(date)
2
? Day(Date)
17
In your case of going over 2 months, in your example, you'd best compare
for each month.
Where (Month(Birthday) = 2 And Day(BirthDay) >= 26) Or
(Month(Birthday) = 3 And Day(BirthDay) <= 4)
Feb 17 '06 #2

P: n/a
thx i'll give it a shot.

Feb 17 '06 #3

P: n/a
SELECT BirthdayTable.Birthday
FROM BirthdayTable
WHERE ((BirthdayTable.Birthday) Between #2/26/2006# And #3/4/2006#);

Feb 17 '06 #4

P: n/a
that wont work, cuz nobody is born in that particular week in 2006 that
work for us. U have to remove the year.

Don't have a working solution sor far but i'll keep thinking about it.

Feb 20 '06 #5

P: n/a
Mal
In a couple of different circumstances I calculate BirthDayThisYear and then
use that for queries etc.
I use the DateSerial function to create that. --- DateSerial(year, month,
day)
so...
(Air code)
Function BirthDayThisYear(myBDate As Date)
BirthDayThisYear = DateSerial(Year(Date), Month(myBDate), Day(myBDate))
BirthDayThisYear = CDate(BirthDayThisYear) 'this may be redundant....
End Function

HTH
Mal.
"No***********@hotmail.com" <ug********@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
that wont work, cuz nobody is born in that particular week in 2006 that
work for us. U have to remove the year.

Don't have a working solution sor far but i'll keep thinking about it.

Feb 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.