Two Date Fields One Criteria

talkiechick

Registered User.
Local time
Today, 15:10
Joined
Apr 15, 2010
Messages
59
Hi, So I have two date fields that i need to pull information from. I do not need duplicate data. However i can not figure out how to set up the expression.

I need date1 to show up if it falls in this 1/31/2010 - 3/31/2010
If date2's date falls within 1/31/201 -3/31/2010 then i need it to show up as well.

One line of data shows date1 and date 2 being exactly the same. But i am not sure how i should go about setting this up.
 
Hi, So I have two date fields that i need to pull information from. I do not need duplicate data. However i can not figure out how to set up the expression.

I need date1 to show up if it falls in this 1/31/2010 - 3/31/2010
If date2's date falls within 1/31/201 -3/31/2010 then i need it to show up as well.

One line of data shows date1 and date 2 being exactly the same. But i am not sure how i should go about setting this up.

Try something like:

Code:
... Where [Date1] between #1/1/2010# and #3/31/2010# or [Date2] between #1/1/2010# and #3/31/2010#

Hope this helps ...
 
I keep putting that in as an expression but it keeps disappearing when i click on another cell. I also tried putting it as a Where and it did the same thing. Am i doing something wrong?
 
Can Someone help me with this? I don't know how to use the Where clause correctly and I am not very good with SQL either.

I Just need to be able to pull a date range from two date fields with and 'either, or' type of mentality.
 
You might want to either upload a copy of your database or provide a screenshot (uploaded here and not to photobucket or any other photo sharing site) showing where you are putting it and how.
 
Bob i have the image ready, but i don't know how to upload it here. I don't see an attachment button nor when i tried to add a photo, the photos sizes were quite small.
 
Ok I have attached the image. We need this query to show which ever date field matchs the given date criteria. I am wondering i should write an expression, use a Where clause, or use a where clause and keep the date criteria in the criteria section of the query.

Thanks
 

Attachments

  • ScrnShot.jpg
    ScrnShot.jpg
    95.4 KB · Views: 126
Switch to SQL view and type in the where clause as suggested by Boyd (HiTech), one has to become competent at SQL to achieve much in Access as it is difficult to explain everythink on the DG , plus some queries, eg UNION are SQL only.

Brian
 
And to state the obvious, you need to replace the [Date1], [Date2] part with the actual names of the fields that you're using. e.g., replace [Date1] with [Maturity Date]
 
ok i tried it in SQL still has error, see the two screen shots attached
 

Attachments

  • ScrnShot2.jpg
    ScrnShot2.jpg
    94.7 KB · Views: 119
Change the Where to a Having or move the Where clause before the Goup By.

Brian
 
Waited to see if you had a follow up , but you signed off so I guess no, so I'm off now.

Brian
 
Thank you Brian, the query now generates... However i do not have a separate column showing me the date it chose. Is there a way in SQL or in DG to have the other column show?
 
Also my data is duplicating and i need each row of data to be unique.
 
Ok fixed my errors thank you so much... All of you Bob, Brian, and HiTech Coach
 

Users who are viewing this thread

Back
Top Bottom