S
Sue
I have 2 dates - DOB (date of birth) and DOA (date of anniversary) for
contacts. I've got a union query that enables me to pull both of these fields
into a single field called CombinedDate. This is the SQL statement for the
union query:
SELECT LastName, FirstName, "Birthday" As CardType, DOB As CombinedDate
FROM tblContacts
UNION ALL SELECT LastName,FirstName, "Anniversary" As CardType, DOA As
CombinedDate
FROM tblContacts
ORDER BY CombinedDate;
I want to query those records where CombinedDate occurs within the next 2
weeks. I have 2 queries that work - one which gives me this info for DOB, and
one which gives me this info for DOA. The expression which gives me this info
for DOA is DateSerial(Year(Date()),Month([DOA]),Day([DOA])), and the
criteria for limiting the query returns to those occuring during the next 2
weeks is Between Date() And Date()+14. (Substitute DOB for DOA, and this
shows you the way the query is designed to give me this info for birthdays.)
What I really want to do is to have a query that pulls this info for both
DOB & DOA together. When I try to design the query using CombinedDate in
place of DOB or DOA, the query simply won't work. I get data mismatch errors,
wrong number of argument errors, and too few parentheses errors (depending on
which approach I try). The one thing I consistently get, in other words, is
errors. No results.
Help?
Thanks so much!!!
contacts. I've got a union query that enables me to pull both of these fields
into a single field called CombinedDate. This is the SQL statement for the
union query:
SELECT LastName, FirstName, "Birthday" As CardType, DOB As CombinedDate
FROM tblContacts
UNION ALL SELECT LastName,FirstName, "Anniversary" As CardType, DOA As
CombinedDate
FROM tblContacts
ORDER BY CombinedDate;
I want to query those records where CombinedDate occurs within the next 2
weeks. I have 2 queries that work - one which gives me this info for DOB, and
one which gives me this info for DOA. The expression which gives me this info
for DOA is DateSerial(Year(Date()),Month([DOA]),Day([DOA])), and the
criteria for limiting the query returns to those occuring during the next 2
weeks is Between Date() And Date()+14. (Substitute DOB for DOA, and this
shows you the way the query is designed to give me this info for birthdays.)
What I really want to do is to have a query that pulls this info for both
DOB & DOA together. When I try to design the query using CombinedDate in
place of DOB or DOA, the query simply won't work. I get data mismatch errors,
wrong number of argument errors, and too few parentheses errors (depending on
which approach I try). The one thing I consistently get, in other words, is
errors. No results.
Help?
Thanks so much!!!