Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find records that do not fall between specified dates?

Status
Not open for further replies.

nunan

Technical User
Feb 11, 2004
41
0
0
GB
Hi

Would someone kindly help me with this query problem please?

The records in my table have a start date and end date as if they are reserved for a period of time. What I want to be able to do is query the table to only show me records that are not reserved between the dates I specify.

For example:

In the table
Item 1 - start date = 01/04/07
end date = 04/04/07
Item 2 - start date = 06/04/07
end date = 09/04/07

In the query, I would like to enter - show me all records where the start date and end date is not between 01/04/07 and 03/04/07.

So the result would be that I only see item 2.

I hope this makes sense and any help is appreciated. I understand this may not be possible in a query and will need to be done with code so I am open to all suggestions.

Thanks
 
I managed to work this out myself, thanks anyway x
 
nunan,
You had the answer in your post.
[tt]WHERE [start date] Not Between #01/04/2007# AND #03/04/2007# OR [end date] Not Between #01/04/2007# AND #03/04/2007#[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Yeah thanks, I was putting Is Not Between originally!!!

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top