Help with a Query

B

Bill Smith

I have inheirted a database from our club where we acknowledge peoples
birthdays. I am not real familar with this database and would like
some help. I need to get this data but I need to only get this data
from people who are up to date on their dues. So how do I add a
statement to the following query where it will only do this if the
"date dues paid" is greater than 9/05/2005?

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM sheet1
WHERE (((sheet1.Bday) Like "01*"));
UNION SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]
FROM sheet1
WHERE (((sheet1.[Spouse Bday]) Like "01*"));

I tried to do it in the following way:

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.[Spouse],
sheet1.Bday, sheet1.Date Dues Paid
FROM sheet1
WHERE ((( sheet1.Date Dues Paid)"> #9/1/2005#")); WHERE
(((sheet1.Bday) Like "01*"));
UNION SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]
FROM sheet1
WHERE (((sheet1.[Spouse Bday]) Like "01*"));

It just keeps giving me an error message Syntax error (missing
operator)

Please help

Bill
 
J

John Spencer

Perhaps the following will solve your immediate problem. It should return
persons with birthdays in January where the dues were paid after 5 Sept
2005.

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month(BDay) = 1
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]

FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month([Spouse BDay]) = 1
 
B

Bill Smith

This looks like it might work but it is showing birthdays in November.
Why is that?

Bill
 
J

John Spencer

I don't know.

Are the all the birthdays in November?
or are the "November" birthdays all on the 1st day of the month?
Are the November birthdays all spouse birthdays or all member birthdays?
Did you accidentally type 11 instead of 1 in the query?

Are BDay and Spouse BDay datetime fields or are they text fields?

You have access to the raw data and to the query itself. You have to
investigate.


Bill Smith said:
This looks like it might work but it is showing birthdays in November.
Why is that?

Bill

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month(BDay) = 1
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]

FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month([Spouse BDay]) = 1
 
B

Bill Smith

I just copied your statement into a new query and it worked fine for
finding the birthday of the person or the spouse that have updated
their membership but for the month of November. I checked and the
number is 1 not 11. The birthday entry is in the form of 01/16 and is
a text file. We only ask for the month and day of their birthday. If I
change the query from a 1 to 11 it gives me all the birthdays in
March. I hope you can help me with this. Thanks

I don't know.

Are the all the birthdays in November?
or are the "November" birthdays all on the 1st day of the month?
Are the November birthdays all spouse birthdays or all member birthdays?
Did you accidentally type 11 instead of 1 in the query?

Are BDay and Spouse BDay datetime fields or are they text fields?

You have access to the raw data and to the query itself. You have to
investigate.


Bill Smith said:
This looks like it might work but it is showing birthdays in November.
Why is that?

Bill

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month(BDay) = 1
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]

FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month([Spouse BDay]) = 1
 
J

John Spencer

So your birtthday fields are text strings. That should be a simple change
to the query.

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND BDay LIKE "11*"
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND [Spouse BDay] LIKE "11*"


You might try the following to make this a little easier.
SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005#
AND BDay LIKE [Enter 2-digit month number - 01 = Jan] & "*"
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005#
AND [Spouse BDay] LIKE [Enter 2-digit month number - 01 = Jan] & "*"


Bill Smith said:
I just copied your statement into a new query and it worked fine for
finding the birthday of the person or the spouse that have updated
their membership but for the month of November. I checked and the
number is 1 not 11. The birthday entry is in the form of 01/16 and is
a text file. We only ask for the month and day of their birthday. If I
change the query from a 1 to 11 it gives me all the birthdays in
March. I hope you can help me with this. Thanks

I don't know.

Are the all the birthdays in November?
or are the "November" birthdays all on the 1st day of the month?
Are the November birthdays all spouse birthdays or all member birthdays?
Did you accidentally type 11 instead of 1 in the query?

Are BDay and Spouse BDay datetime fields or are they text fields?

You have access to the raw data and to the query itself. You have to
investigate.


Bill Smith said:
This looks like it might work but it is showing birthdays in November.
Why is that?

Bill

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month(BDay) = 1
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]

FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month([Spouse BDay]) = 1
 
B

Bill Smith

John, that did it. Thanks so much.

Bill

So your birtthday fields are text strings. That should be a simple change
to the query.

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND BDay LIKE "11*"
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND [Spouse BDay] LIKE "11*"


You might try the following to make this a little easier.
SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005#
AND BDay LIKE [Enter 2-digit month number - 01 = Jan] & "*"
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005#
AND [Spouse BDay] LIKE [Enter 2-digit month number - 01 = Jan] & "*"


Bill Smith said:
I just copied your statement into a new query and it worked fine for
finding the birthday of the person or the spouse that have updated
their membership but for the month of November. I checked and the
number is 1 not 11. The birthday entry is in the form of 01/16 and is
a text file. We only ask for the month and day of their birthday. If I
change the query from a 1 to 11 it gives me all the birthdays in
March. I hope you can help me with this. Thanks

I don't know.

Are the all the birthdays in November?
or are the "November" birthdays all on the 1st day of the month?
Are the November birthdays all spouse birthdays or all member birthdays?
Did you accidentally type 11 instead of 1 in the query?

Are BDay and Spouse BDay datetime fields or are they text fields?

You have access to the raw data and to the query itself. You have to
investigate.


This looks like it might work but it is showing birthdays in November.
Why is that?

Bill

SELECT sheet1.[First Name], sheet1.[Last Name], sheet1.Bday
FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month(BDay) = 1
UNION
SELECT sheet1.Spouse, sheet1.[Last Name], sheet1.[Spouse Bday]

FROM Sheet1
WHERE [Date Dues Paid] > #9/5/2005# AND Month([Spouse BDay]) = 1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top