I have a text field with birth dates. The field is formatted with only the month and the year. Sometimes only the year is available. I want to run a query that will return birth dates within today's month. My query looks like this:
Code:
SELECT Salutation.Salutation, Valid_Numbers.[First Name] & " " & [Last Name] AS Name, Valid_Numbers.[House Number] & " " & [Street Name] AS Address, Valid_Numbers.City, Valid_Numbers.ST, Valid_Numbers.ZIP, Valid_Numbers.[Date of Birth]
FROM Salutation INNER JOIN Valid_Numbers ON Salutation.ID=Valid_Numbers.Salutation
WHERE Len(Valid_Numbers.[Date of Birth])=7 And Switch(Left(valid_numbers.[house number],1)<>0,Left(Valid_Numbers.[Date of Birth],2)=Month(Date()),Left(valid_numbers.[house number],1)=0,Mid(Valid_Numbers.[Date of Birth],InStr(3,Valid_Numbers.[Date of Birth],"/")-1,1)=Month(Date()));