Splitting a Date

Sandpiper

Registered User.
Local time
Today, 06:32
Joined
Feb 21, 2006
Messages
55
I've currently got a date of birth field in my database, but would like to query on just the birth month.
Can anyone tell me how to do it. Do I have to create another field which separates out the month, and if so, how do I do that.

Any help would be much appreciated.
 
Hi -

Am guessing that you're trying to create a birthday list. If so,
here's an example using tblClients (change to your table name).

Try copying/pasting this to a new query, modifying the table and
field names to correspond to your table. Run the query and, when
prompted, reply with the numeric month identifier (e.g. 1 = Jan,
4 = Apr, 11 = Nov, etc..)

See if that is close to what you're after:
Code:
SELECT
    Format([DOB],"mmmm d") AS Expr1
  , LastName
  , FirstName
FROM
   tblClients
WHERE
   (((Month([DOB]))=[enter month]))
ORDER BY
   Format([DOB],"mmmm d")
  , LastName
  , FirstName;
HTH - Bob
 
Minor tweak :)

ORDER BY
Format([DOB],"mmdd")

HTH

Peter
 
Excellent - that worked perfectly.
Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom