assuming you have two date variables.. startDate and endDate.. WHERE (day > #day(startDate)#) AND (month > #month(startDate)#) AND (day < #day(endDate)#) AND (month < #month(endDate)#)
Mike Kear wrote: > I have a database containing a list of events (birthdays, > anniversaries etc), and want to produce a listing of the events > relating to this week, this month, today etc as the user requests on > the form I give them. > > Because not everyone's birth year is known, not all the birthdays have > a year. they all have a day and a month however, but that's all that > really matters for the selection of the record, I think. > > The relevant parts of the Anniversaries table is as follows: > > EventID int PrimaryKey Identity > Name varchar 50 > EventType varchar 10 (i.e. birthday, deathday, anniv) > day int > month int > year int > comments varchar 500 > > > I"m having trouble working out the SQL for this table if i want to > find the anniversaries that fall between two dates. (for example from > last sunday to next sunday) > > IN pseudo code, the SQL goes like this (after turning the form dates > into a odbcdate object): > > SELECT * from Anniversaries WHERE > > day/month is greater than beginningday/month > AND > day/month is less than endingday/month > > > IT's the date aspect that's giving me the heebeegeebees. Nothing I > try generates anything other than error messages. GRRRR. > > Or perhaps I should change the way I store the anniversary in > formation to date objects rather than just integer fields. No? > -- Umer Farooq Octadyne Systems [EMAIL PROTECTED] +1 (519) 489-1119 voice +1 (519) 635-2795 mobile +1 (530) 326-3586 fax WEB SOLUTIONS FOR NON-PROFIT ORGANIZATION: http://www.Non-ProfitSites.biz WARNING: ------------------------------- The information contained in this document and attachments is confidential and intended only for the person(s) named above. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution, or any other use of the information is strictly prohibited. If you have received this document by mistake, please notify the sender immediately and destroy this document and attachments without making any copy of any kind. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192515 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54