create query having a date field then filter only the month?

P

poging cute

I have a Table with a Birthday field and its type is DATE. How will i filter
or query those records whose birthday is NOVEMBER?

please help me.
 
M

Marshall Barton

poging cute said:
I have a Table with a Birthday field and its type is DATE. How will i filter
or query those records whose birthday is NOVEMBER?


Create a query for the fields in the table. Add a
calculated column

BirthMonth: Month(Birthday)

and set its Criteria to 11

If you want to get more elaborate, then use the query as the
Record Source for a form. Add a text box to the form's
header section for users to enter the month number, then the
query's criteria would look like

Forms!theform.thetextbox
 
J

Joe D

Try this: in query field ... SelectedMonth: DatePart("m",[Birthday])
in the criteria... 11 (no quotes on this)

Name the field as you like (SelectedMonth or NovDate or whatever).
Replace [Birthday] with your actual date field name.
Then, of course, add any other fields you need to complete the query.

To use with any month, just replace the 11 in the criteria with a parameter
(eg [Enter Month Number]) and it will prompt you for any month you want.

HTH
 
P

poging cute

Marshall Barton said:
Create a query for the fields in the table. Add a
calculated column

BirthMonth: Month(Birthday)

and set its Criteria to 11

If you want to get more elaborate, then use the query as the
Record Source for a form. Add a text box to the form's
header section for users to enter the month number, then the
query's criteria would look like

Forms!theform.thetextbox

Thanks, it worked.
Thanks, it worked.
Thanks, it worked.
Thanks, it worked.
 
P

poging cute

Thanks, it worked.
Thanks, it worked.
Thanks, it worked.
Thanks, it worked.

Joe D said:
Try this: in query field ... SelectedMonth: DatePart("m",[Birthday])
in the criteria... 11 (no quotes on this)

Name the field as you like (SelectedMonth or NovDate or whatever).
Replace [Birthday] with your actual date field name.
Then, of course, add any other fields you need to complete the query.

To use with any month, just replace the 11 in the criteria with a parameter
(eg [Enter Month Number]) and it will prompt you for any month you want.

HTH

poging cute said:
I have a Table with a Birthday field and its type is DATE. How will i filter
or query those records whose birthday is NOVEMBER?

please help me.
 

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