Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dsb dsb is offline
external usenet poster
 
Posts: 3
Default Searching a range with MS Query

I have an ODBC connection in Excel, and the field I am looking at is a start
date field and an end date field. I need to be able to enter a start date
and an end date and return items that DO NOTmeet the criteria. I have two
columns in my query, start_date and end_date and the values are [start date]
[end date] respectively. They prompt for date entries. Even if I use a =
and <, etc. it still only returns items that are the exact dates, so if i
put in 9:00 am to 11:00 am if the item starts at 8:00 am and ends at 11:15 it
returns it as if it doesnt see that it meets part of the criteria, which it
probably shoudnt because I do not have it set up correctly.

I do not know how to get this to return items that do not meet the start and
end dates. I need to know if anything occurs between the start and end date
and not return those results. Confusing?

I need help with my logic, so if someone can provide help that would be great.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Searching a range with MS Query

Can you post a bit more information?

What's the data source? An Excel data list? An MS Access table or query?

You mention that you need DATE criteria, but you're using TIME in your
examples. Are there separate date and time fields? or are they combined into
one value?

It seems that you are looking for records that are NOT active at any time
between the [start date] and the [end date]. Is that correct?

Can you post enough of your current SQL so we'll be better able to see what
you've tried so far?
***********
Regards,
Ron

XL2002, WinXP


"dsb" wrote:

I have an ODBC connection in Excel, and the field I am looking at is a start
date field and an end date field. I need to be able to enter a start date
and an end date and return items that DO NOTmeet the criteria. I have two
columns in my query, start_date and end_date and the values are [start date]
[end date] respectively. They prompt for date entries. Even if I use a =
and <, etc. it still only returns items that are the exact dates, so if i
put in 9:00 am to 11:00 am if the item starts at 8:00 am and ends at 11:15 it
returns it as if it doesnt see that it meets part of the criteria, which it
probably shoudnt because I do not have it set up correctly.

I do not know how to get this to return items that do not meet the start and
end dates. I need to know if anything occurs between the start and end date
and not return those results. Confusing?

I need help with my logic, so if someone can provide help that would be great.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dsb dsb is offline
external usenet poster
 
Posts: 3
Default Searching a range with MS Query

The SQL is as follows:

SELECT sp_reservations.rsrv_start_dt, sp_reservations.rsrv_end_dt,
rooms.last_mod_user, rooms.max_capacity, rooms.room_long
FROM RESOURCE25.dbo.rooms rooms, RESOURCE25.dbo.sp_reservations
sp_reservations
WHERE rooms.room_id = sp_reservations.room_id AND
((sp_reservations.rsrv_end_dt<=?) AND (sp_reservations.rsrv_start_dt=?))

Yes, the date and time field is combined (ex. 2007-01-09 14:00:00.00). It
is pulling from a Microsoft SQL database. Yes I am looking for records that
are inactive. The date/time ranges are attached to a room assignment. I
want to be able to look for start and end date/times and return the rooms
that do not have the criteria associated with them, the date/time range.

Perhaps, and I do not know how, I can create a separate table that splits
the date/time that contains the room identifier or name, then search that
data somehow.

Does this help?

Thanks

"Ron Coderre" wrote:

Can you post a bit more information?

What's the data source? An Excel data list? An MS Access table or query?

You mention that you need DATE criteria, but you're using TIME in your
examples. Are there separate date and time fields? or are they combined into
one value?

It seems that you are looking for records that are NOT active at any time
between the [start date] and the [end date]. Is that correct?

Can you post enough of your current SQL so we'll be better able to see what
you've tried so far?
***********
Regards,
Ron

XL2002, WinXP


"dsb" wrote:

I have an ODBC connection in Excel, and the field I am looking at is a start
date field and an end date field. I need to be able to enter a start date
and an end date and return items that DO NOTmeet the criteria. I have two
columns in my query, start_date and end_date and the values are [start date]
[end date] respectively. They prompt for date entries. Even if I use a =
and <, etc. it still only returns items that are the exact dates, so if i
put in 9:00 am to 11:00 am if the item starts at 8:00 am and ends at 11:15 it
returns it as if it doesnt see that it meets part of the criteria, which it
probably shoudnt because I do not have it set up correctly.

I do not know how to get this to return items that do not meet the start and
end dates. I need to know if anything occurs between the start and end date
and not return those results. Confusing?

I need help with my logic, so if someone can provide help that would be great.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Searching a range with MS Query

As long as the [start_criteria] and [end_criteria] are expressed as date/time,
can it be as simple as replacing your AND with OR?:

SELECT
sp_reservations.rsrv_start_dt,
sp_reservations.rsrv_end_dt,
rooms.last_mod_user,
rooms.max_capacity,
rooms.room_long
FROM
RESOURCE25.dbo.rooms rooms,
RESOURCE25.dbo.sp_reservations sp_reservations
WHERE
rooms.room_id = sp_reservations.room_id
AND
(
(sp_reservations.rsrv_end_dt<=[start_criteria])
OR
(sp_reservations.rsrv_start_dt=[end_criteria])
)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"dsb" wrote:

The SQL is as follows:

SELECT sp_reservations.rsrv_start_dt, sp_reservations.rsrv_end_dt,
rooms.last_mod_user, rooms.max_capacity, rooms.room_long
FROM RESOURCE25.dbo.rooms rooms, RESOURCE25.dbo.sp_reservations
sp_reservations
WHERE rooms.room_id = sp_reservations.room_id AND
((sp_reservations.rsrv_end_dt<=?) AND (sp_reservations.rsrv_start_dt=?))

Yes, the date and time field is combined (ex. 2007-01-09 14:00:00.00). It
is pulling from a Microsoft SQL database. Yes I am looking for records that
are inactive. The date/time ranges are attached to a room assignment. I
want to be able to look for start and end date/times and return the rooms
that do not have the criteria associated with them, the date/time range.

Perhaps, and I do not know how, I can create a separate table that splits
the date/time that contains the room identifier or name, then search that
data somehow.

Does this help?

Thanks

"Ron Coderre" wrote:

Can you post a bit more information?

What's the data source? An Excel data list? An MS Access table or query?

You mention that you need DATE criteria, but you're using TIME in your
examples. Are there separate date and time fields? or are they combined into
one value?

It seems that you are looking for records that are NOT active at any time
between the [start date] and the [end date]. Is that correct?

Can you post enough of your current SQL so we'll be better able to see what
you've tried so far?
***********
Regards,
Ron

XL2002, WinXP


"dsb" wrote:

I have an ODBC connection in Excel, and the field I am looking at is a start
date field and an end date field. I need to be able to enter a start date
and an end date and return items that DO NOTmeet the criteria. I have two
columns in my query, start_date and end_date and the values are [start date]
[end date] respectively. They prompt for date entries. Even if I use a =
and <, etc. it still only returns items that are the exact dates, so if i
put in 9:00 am to 11:00 am if the item starts at 8:00 am and ends at 11:15 it
returns it as if it doesnt see that it meets part of the criteria, which it
probably shoudnt because I do not have it set up correctly.

I do not know how to get this to return items that do not meet the start and
end dates. I need to know if anything occurs between the start and end date
and not return those results. Confusing?

I need help with my logic, so if someone can provide help that would be great.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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
Searching for partial text match in range [email protected] Excel Worksheet Functions 3 September 12th 06 05:58 AM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Creating Date Range in Pivot Microsoft Query Ian Excel Discussion (Misc queries) 0 November 20th 05 10:10 PM
3d range searching thephoenix12 Excel Discussion (Misc queries) 0 June 15th 05 06:18 PM
Searching text in a cell range ShareerIslamabadiMunda Excel Worksheet Functions 7 December 16th 04 09:55 PM


All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"