Specifying Time in m_strFilter 
Author Message
 Specifying Time in m_strFilter

I'm querying an Access database using CRecordset.
I can get a set of records based on a date range using an m_strFilter of

(TheDate >= {TS '2000-1-15 00:00:00'}) AND (TheDate <= {TS '2000-1-17
23:59:59'}

which gets records between 15th and 17th of January inclusive.

But how can I refine this so that within that date range I only get
records where the time-of-day is after 6pm? (For instance I want to list
only *evening* reservations for a range of dates).

I tried adding an extra term to the above like this:

AND (TheDate >= {T '18:00:00'})

but it seemed to make no difference - I still got ALL of the records for
the date range.

I know that I can scan through the records and discard them 'manually'
but it would be nice to be able to build the time-of-day into the filter
itself.

Does anyone know how this is done?

Thanks

Richard

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 29 Jul 2002 03:00:00 GMT  
 Specifying Time in m_strFilter
What about:

... AND (DATEPART("h", TheDate) >= 18)

-Paul

--------------------------------------------------------
Paul Little, Senior Programmer/Analyst
SVi Retail Systems
San Diego, CA

Quote:

> I'm querying an Access database using CRecordset.
> I can get a set of records based on a date range using an m_strFilter of

> (TheDate >= {TS '2000-1-15 00:00:00'}) AND (TheDate <= {TS '2000-1-17
> 23:59:59'}

> which gets records between 15th and 17th of January inclusive.

> But how can I refine this so that within that date range I only get
> records where the time-of-day is after 6pm? (For instance I want to list
> only *evening* reservations for a range of dates).

> I tried adding an extra term to the above like this:

> AND (TheDate >= {T '18:00:00'})

> but it seemed to make no difference - I still got ALL of the records for
> the date range.

> I know that I can scan through the records and discard them 'manually'
> but it would be nice to be able to build the time-of-day into the filter
> itself.

> Does anyone know how this is done?

> Thanks

> Richard

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 29 Jul 2002 03:00:00 GMT  
 Specifying Time in m_strFilter
Thanks Paul, I'll give that a try.

Colin



Quote:
> What about:

> ... AND (DATEPART("h", TheDate) >= 18)

> -Paul

> --------------------------------------------------------
> Paul Little, Senior Programmer/Analyst
> SVi Retail Systems
> San Diego, CA




Quote:
> > I'm querying an Access database using CRecordset.
> > I can get a set of records based on a date range using an
m_strFilter of

> > (TheDate >= {TS '2000-1-15 00:00:00'}) AND (TheDate <= {TS
'2000-1-17
> > 23:59:59'}

> > which gets records between 15th and 17th of January inclusive.

> > But how can I refine this so that within that date range I only get
> > records where the time-of-day is after 6pm? (For instance I want to
list
> > only *evening* reservations for a range of dates).

> > I tried adding an extra term to the above like this:

> > AND (TheDate >= {T '18:00:00'})

> > but it seemed to make no difference - I still got ALL of the records
for
> > the date range.

> > I know that I can scan through the records and discard them
'manually'
> > but it would be nice to be able to build the time-of-day into the
filter
> > itself.

> > Does anyone know how this is done?

> > Thanks

> > Richard

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 02 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Specify criteria for m_strFilter with CDaoRecordset

2. COM+ activation failed because the activation could not be completed in the specified amount of time

3. specify array size at run time

4. Popping a window at a specified time

5. Firing event at specified time

6. m_strFilter question.

7. Query Dialog and m_strFilter

8. m_strfilter please

9. newbis sruggling with m_strFilter...please help

10. CDaoRecordset::m_strFilter parameter not substituted?

11. DAO m_strFilter and WildCards

12. Help with m_strFilter

 

 
Powered by phpBB® Forum Software