471,573 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,573 software developers and data experts.

Birthday in a query?

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
5 5014
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
thx i'll give it a shot.

Feb 17 '06 #3
SELECT BirthdayTable.Birthday
FROM BirthdayTable
WHERE ((BirthdayTable.Birthday) Between #2/26/2006# And #3/4/2006#);

Feb 17 '06 #4
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
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.

Similar topics

reply views Thread by Peter Ruijter | last post: by
51 posts views Thread by Sandra | last post: by
1 post views Thread by Claude Alain | last post: by
2 posts views Thread by David Garamond | last post: by
kestrel
13 posts views Thread by kestrel | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.