Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Access

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-04-2006, 07:45 AM
Novice
 
Join Date: Jun 2005
Posts: 6
gemini2
Default Finding data between two date for any year

I'm trying to do a query to pull out data between 02/28/**** and 11/15/**** . Each time I put this in the query I getting a mix match data error. Is there a way better way to code this?
Reply With Quote
  #2  
Old 04-04-2006, 05:37 PM
Expert
 
Join Date: Dec 2005
Location: Wilmington, DE - USA
Posts: 275
matthewspatrick
Send a message via MSN to matthewspatrick
Default

Something like this would work:

SELECT <some fields>
FROM <some table>
WHERE DateField BETWEEN DateSerial(Year(DateField), 2, 28) AND DateSerial(Year(DateField), 11, 15)
Reply With Quote
  #3  
Old 04-04-2006, 05:39 PM
Expert
 
Join Date: Dec 2005
Location: Wilmington, DE - USA
Posts: 275
matthewspatrick
Send a message via MSN to matthewspatrick
Default

OK, the editor turned eight-parenthesis to a smiley!


SELECT <some fields>
FROM <some table>
WHERE DateField BETWEEN DateSerial(Year(DateField), 2, 28 ) AND DateSerial(Year(DateField), 11, 15)
Reply With Quote
  #4  
Old 04-04-2006, 08:42 PM
Novice
 
Join Date: Jun 2005
Posts: 6
gemini2
Default Finding data between two date for any year

This is good,but I didn't get the results I was expecting and that was my fault. I should had said that I only want the data between 11/15**** and 02?23****. Therefore I shouldn't see any data before 11/15 of any year and nothing after 02/28 for any year. When coding what you sent me I'm getting dates showing for the month of 03, 04, 05, etc...

Here is the code I used;
Between DateSerial(Year([reportingdate]),11,15) And DateSerial(Year([reportingdate]),2,28)

Even if I switch the dates around I get the same results.
Reply With Quote
  #5  
Old 04-05-2006, 04:20 AM
Expert
 
Join Date: Dec 2005
Location: Wilmington, DE - USA
Posts: 275
matthewspatrick
Send a message via MSN to matthewspatrick
Default

gemini,

The problem is that you are not using a between.

SELECT <some fields>
FROM <some table>
WHERE (DateField <= DateSerial(Year(DateField), 2, 28 )) OR (DateField >= DateSerial(Year(DateField), 11, 15))
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing a date to the current year fdnyfish Access 1 03-01-2008 05:34 AM
Finding data that doesn't match dlhayes Queries 1 11-11-2006 05:14 PM
Retrieving Week of Year in a date range Korvega Queries 2 05-27-2006 04:29 AM
How to report data in fical year order gemini2 Reports 1 05-27-2006 04:26 AM
Make sure end date is one year greater than start date AimeeK Forms 1 12-09-2005 07:29 PM


All times are GMT -8. The time now is 08:30 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.