INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Simple Date Filter

Simple Date Filter

(OP)
I searched and I feel so ignorant... I'm trying to filter a list of songs that were performed this calendar year. Here's the query:

This one works but doesn't filter by date:

CODE --> SQL

SELECT tblSongs.Title, tblEvents.Date
FROM tblSongs INNER JOIN (tblEvents INNER JOIN tblHistLink ON tblEvents.EventID = tblHistLink.EventID) ON tblSongs.SongID = tblHistLink.SongID
ORDER BY tblEvents.Date DESC , tblSongs.Title, tblEvents.Date; 

Here I tried to filter using =Year(Now())

CODE --> SQL

SELECT tblSongs.Title, tblEvents.Date
FROM tblSongs INNER JOIN (tblEvents INNER JOIN tblHistLink ON tblEvents.EventID = tblHistLink.EventID) ON tblSongs.SongID = tblHistLink.SongID
WHERE (((tblEvents.Date)=Year(Now())))
ORDER BY tblEvents.Date DESC , tblSongs.Title, tblEvents.Date; 

Here I tried to filter using =Year(Date())

CODE --> SQL

SELECT tblSongs.Title, tblEvents.Date
FROM tblSongs INNER JOIN (tblEvents INNER JOIN tblHistLink ON tblEvents.EventID = tblHistLink.EventID) ON tblSongs.SongID = tblHistLink.SongID
WHERE (((tblEvents.Date)=Year(Date())))
ORDER BY tblEvents.Date DESC , tblSongs.Title, tblEvents.Date; 

Obviously the last two returned empty results.

I feel so dumb. I appreciate your help!!

Thanks!!


Matt

RE: Simple Date Filter

Hi,

CODE

WHERE YEAR(tblEvents.Date)=Year(Date) 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Simple Date Filter

(OP)
It's funny, when I just looked at the SQL I realized what the problem was but I still didn't know what the right syntax would be. You're amazing Skip. Is there anything you don't know??? :)

Thanks!!


Matt

RE: Simple Date Filter

Oh, yes. Lots anf lots!

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Simple Date Filter

(OP)
Well shoot, I just got around to implementing your fix, and I'm getting the whole list and not just the songs that we performed this calendar year.

CODE --> SQL

SELECT tblSongs.Title, tblEvents.Date
FROM tblSongs INNER JOIN (tblEvents INNER JOIN tblHistLink ON tblEvents.EventID = tblHistLink.EventID) ON tblSongs.SongID = tblHistLink.SongID
WHERE (((Year([tblEvents].[Date]))=Year([Date])))
ORDER BY tblEvents.Date DESC; 

Not sure... what to fix...

Thanks!!


Matt

RE: Simple Date Filter

(OP)
Hey, I figured it out! I used

CODE -->

WHERE (((Year([tblEvents].[Date]))=Year(Now()))) 

Thanks!!


Matt

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close