Same Date differant year

B

Bill

Hope someone can help me out or point me to an article that can. What I’m
trying to do is used “Like†to find all records in my table’s “gmDate†column
that have the same date but not the same year. The table has dates going back
about 25 years. The column format is “Short Dateâ€.
Thanks,
Bill
 
J

Jerry Whittle

Copy and paste the following in a new query in SQL view.

PARAMETERS [Enter the day of the month] Short,
[Enter the number of the month] Short;
SELECT ASIF.*
FROM ASIF
WHERE DatePart("d",[gmDate])=[Enter the day of the month]
AND DatePart("m",[gmDate])=[Enter the number of the month];

Change ASIF to the name of the table.

The above will prompt for the day number first. Next it will ask for the the
number of the month. You need to put in 3 for March.
 
K

kc-mass

Hi Bill

I don't think you want to use the "Like" function

Try something like:
DaysIWantInfoOn: Month(GmDate) & "/" & Day(GmDate) ="12/15"

That will hand back all the records dated the 15th of December regardless of
year.

Regards

Kevin
 
B

Bill

Jerry
Thanks alot works great. Now to study it to see how I can further use it.
Again thanks,
Bill

Jerry Whittle said:
Copy and paste the following in a new query in SQL view.

PARAMETERS [Enter the day of the month] Short,
[Enter the number of the month] Short;
SELECT ASIF.*
FROM ASIF
WHERE DatePart("d",[gmDate])=[Enter the day of the month]
AND DatePart("m",[gmDate])=[Enter the number of the month];

Change ASIF to the name of the table.

The above will prompt for the day number first. Next it will ask for the the
number of the month. You need to put in 3 for March.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Bill said:
Hope someone can help me out or point me to an article that can. What I’m
trying to do is used “Like†to find all records in my table’s “gmDate†column
that have the same date but not the same year. The table has dates going back
about 25 years. The column format is “Short Dateâ€.
Thanks,
Bill
 
B

Bill

Kevin,
Thanks for the input. I am not quite sure where I should enter your
function in my query. Maybe you can explain. I am been a bit off my game
lately and seem to be missing something.
Thanks,
Bill
 

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