PC Review


Reply
Thread Tools Rate Thread

Access query on date/TIme field for date then there is no time?

 
 
=?Utf-8?B?QmFuaw==?=
Guest
Posts: n/a
 
      4th Feb 2006
I have a date/time field that I need to execute a date range search. The
field always has a date, but may not have a time. When I execute a between
date criteria I only get a few item when there are 100's in the range. Any
sugestions?

thanks
Bank
 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      4th Feb 2006
A dateTime field always has a time. The time is midnight if no time is input.

When it fails what is the date range you are looking for? If it is a one-day
range the problem may be that the field does actually have a time in it and your
format settings are "hiding" the time from you.

When you get just a few items, are they in the date range you have specified?

Bank wrote:
>
> I have a date/time field that I need to execute a date range search. The
> field always has a date, but may not have a time. When I execute a between
> date criteria I only get a few item when there are 100's in the range. Any
> sugestions?
>
> thanks
> Bank

 
Reply With Quote
 
=?Utf-8?B?QmFuaw==?=
Guest
Posts: n/a
 
      6th Feb 2006
John,
I am doing a between request using a start and end date. The test is for
one year. I receive items only for the year range. Some items retreived
have the date and time, some only show the date. I get 15 items when there
are hundreds with a date, no time, entered within the date range.

Thanks,
Scott

"John Spencer" wrote:

> A dateTime field always has a time. The time is midnight if no time is input.
>
> When it fails what is the date range you are looking for? If it is a one-day
> range the problem may be that the field does actually have a time in it and your
> format settings are "hiding" the time from you.
>
> When you get just a few items, are they in the date range you have specified?
>
> Bank wrote:
> >
> > I have a date/time field that I need to execute a date range search. The
> > field always has a date, but may not have a time. When I execute a between
> > date criteria I only get a few item when there are 100's in the range. Any
> > sugestions?
> >
> > thanks
> > Bank

>

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      7th Feb 2006
Can you post the actual SQL?

Also, check and make sure that datetime field is actually a date time field and
not a text field containing a string that looks like a date and a time.

One thing you might try

Field: RealDate: IIF([YourDateField] is Not Null,DateValue([YourDateField]),Null)
Criteria: Between #2005/01/01# and #2005/12/31#

That does two things - the calculated REALDate forces the value in the field to
be a date.
The criteria uses a date format that must be interpreted as Jan 1 2005 to Dec 31 2005.

If this works, then you can try entering dates in your standard method. If that
works, then you should be reasonably sure that the date you are searching for is
being treated as a string.



Bank wrote:
>
> John,
> I am doing a between request using a start and end date. The test is for
> one year. I receive items only for the year range. Some items retreived
> have the date and time, some only show the date. I get 15 items when there
> are hundreds with a date, no time, entered within the date range.
>
> Thanks,
> Scott
>
> "John Spencer" wrote:
>
> > A dateTime field always has a time. The time is midnight if no time is input.
> >
> > When it fails what is the date range you are looking for? If it is a one-day
> > range the problem may be that the field does actually have a time in it and your
> > format settings are "hiding" the time from you.
> >
> > When you get just a few items, are they in the date range you have specified?
> >
> > Bank wrote:
> > >
> > > I have a date/time field that I need to execute a date range search. The
> > > field always has a date, but may not have a time. When I execute a between
> > > date criteria I only get a few item when there are 100's in the range. Any
> > > sugestions?
> > >
> > > thanks
> > > Bank

> >

 
Reply With Quote
 
=?Utf-8?B?Y2FtaWxpYQ==?=
Guest
Posts: n/a
 
      22nd Feb 2006
Hello,
I have a database that maintainthe equipments. I want to be able to run a
report to show me all the equipments that are due within 30 days for
maintenance
Hope some bodyy can help me with that.
Right now on my query I have <30, which doesn't do anything:-(

Thanks alot
--
camilia


"Bank" wrote:

> I have a date/time field that I need to execute a date range search. The
> field always has a date, but may not have a time. When I execute a between
> date criteria I only get a few item when there are 100's in the range. Any
> sugestions?
>
> thanks
> Bank

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      23rd Feb 2006
Do you have a datetime field that shows when maintenance is due?
Assumptions:
Datetime field that specifies date due for maintenance.
You want those items that have maintenance scheduled in the next (future) 30
days.

Field: DateDue
Criteria: Between Date() and Date()+30

If you want those that are overdue (for the last 30 days)
Criteria: Between Date()-30 and Date()

If you want those that are overdue at 30 or more days
Criteria: <Date()-30


"camilia" <(E-Mail Removed)> wrote in message
news:F6984FCB-EEB7-4CDA-BE82-(E-Mail Removed)...
> Hello,
> I have a database that maintainthe equipments. I want to be able to run a
> report to show me all the equipments that are due within 30 days for
> maintenance
> Hope some bodyy can help me with that.
> Right now on my query I have <30, which doesn't do anything:-(
>
> Thanks alot
> --
> camilia
>
>
> "Bank" wrote:
>
>> I have a date/time field that I need to execute a date range search. The
>> field always has a date, but may not have a time. When I execute a
>> between
>> date criteria I only get a few item when there are 100's in the range.
>> Any
>> sugestions?
>>
>> thanks
>> Bank



 
Reply With Quote
 
=?Utf-8?B?Y2FtaWxpYQ==?=
Guest
Posts: n/a
 
      23rd Feb 2006
Thanks for your respond
The MaintDueDate is set up as a text in my table
I tried Between Date() and Date()+30 and it shows me one equiment that was
due in Feb and couple equipments in March.
I need to run a report every month to get all the equipments that are due in
that month.
I have been working on this for a long time and I am not getting anywhere:-(
--
camilia


"John Spencer" wrote:

> Do you have a datetime field that shows when maintenance is due?
> Assumptions:
> Datetime field that specifies date due for maintenance.
> You want those items that have maintenance scheduled in the next (future) 30
> days.
>
> Field: DateDue
> Criteria: Between Date() and Date()+30
>
> If you want those that are overdue (for the last 30 days)
> Criteria: Between Date()-30 and Date()
>
> If you want those that are overdue at 30 or more days
> Criteria: <Date()-30
>
>
> "camilia" <(E-Mail Removed)> wrote in message
> news:F6984FCB-EEB7-4CDA-BE82-(E-Mail Removed)...
> > Hello,
> > I have a database that maintainthe equipments. I want to be able to run a
> > report to show me all the equipments that are due within 30 days for
> > maintenance
> > Hope some bodyy can help me with that.
> > Right now on my query I have <30, which doesn't do anything:-(
> >
> > Thanks alot
> > --
> > camilia
> >
> >
> > "Bank" wrote:
> >
> >> I have a date/time field that I need to execute a date range search. The
> >> field always has a date, but may not have a time. When I execute a
> >> between
> >> date criteria I only get a few item when there are 100's in the range.
> >> Any
> >> sugestions?
> >>
> >> thanks
> >> Bank

>
>
>

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      23rd Feb 2006
So if you run the report in February of 2006 you want to show all equipment
with a MaintDueDate in February and if you run the report in July 2007 then
you want all equipment with a MaintDueDate in July of 2007.

If that is correct

Field: MaintDueDate
Criteria: Between DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())=1,0)

That will get every MaintDueDate record in the current month of the current
year.

"camilia" <(E-Mail Removed)> wrote in message
news:A3EFC1CB-7B53-4E7A-B7CC-(E-Mail Removed)...
> Thanks for your respond
> The MaintDueDate is set up as a text in my table
> I tried Between Date() and Date()+30 and it shows me one equiment that
> was
> due in Feb and couple equipments in March.
> I need to run a report every month to get all the equipments that are due
> in
> that month.
> I have been working on this for a long time and I am not getting
> anywhere:-(
> --
> camilia
>
>
> "John Spencer" wrote:
>
>> Do you have a datetime field that shows when maintenance is due?
>> Assumptions:
>> Datetime field that specifies date due for maintenance.
>> You want those items that have maintenance scheduled in the next (future)
>> 30
>> days.
>>
>> Field: DateDue
>> Criteria: Between Date() and Date()+30
>>
>> If you want those that are overdue (for the last 30 days)
>> Criteria: Between Date()-30 and Date()
>>
>> If you want those that are overdue at 30 or more days
>> Criteria: <Date()-30
>>
>>
>> "camilia" <(E-Mail Removed)> wrote in message
>> news:F6984FCB-EEB7-4CDA-BE82-(E-Mail Removed)...
>> > Hello,
>> > I have a database that maintainthe equipments. I want to be able to run
>> > a
>> > report to show me all the equipments that are due within 30 days for
>> > maintenance
>> > Hope some bodyy can help me with that.
>> > Right now on my query I have <30, which doesn't do anything:-(
>> >
>> > Thanks alot
>> > --
>> > camilia
>> >
>> >
>> > "Bank" wrote:
>> >
>> >> I have a date/time field that I need to execute a date range search.
>> >> The
>> >> field always has a date, but may not have a time. When I execute a
>> >> between
>> >> date criteria I only get a few item when there are 100's in the range.
>> >> Any
>> >> sugestions?
>> >>
>> >> thanks
>> >> Bank

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?Y2FtaWxpYQ==?=
Guest
Posts: n/a
 
      23rd Feb 2006
Hi John,
Yes, when I run the report lets say on March 1st, I want to see all the
equipments that are due in March and same thing in April
I tried what you suggested to do, but it gave me all the records in December.
Am I missing something???
Thanks alot for your help
--
camilia


"John Spencer" wrote:

> So if you run the report in February of 2006 you want to show all equipment
> with a MaintDueDate in February and if you run the report in July 2007 then
> you want all equipment with a MaintDueDate in July of 2007.
>
> If that is correct
>
> Field: MaintDueDate
> Criteria: Between DateSerial(Year(Date()),Month(Date()),1) And
> DateSerial(Year(Date()),Month(Date())=1,0)
>
> That will get every MaintDueDate record in the current month of the current
> year.
>
> "camilia" <(E-Mail Removed)> wrote in message
> news:A3EFC1CB-7B53-4E7A-B7CC-(E-Mail Removed)...
> > Thanks for your respond
> > The MaintDueDate is set up as a text in my table
> > I tried Between Date() and Date()+30 and it shows me one equiment that
> > was
> > due in Feb and couple equipments in March.
> > I need to run a report every month to get all the equipments that are due
> > in
> > that month.
> > I have been working on this for a long time and I am not getting
> > anywhere:-(
> > --
> > camilia
> >
> >
> > "John Spencer" wrote:
> >
> >> Do you have a datetime field that shows when maintenance is due?
> >> Assumptions:
> >> Datetime field that specifies date due for maintenance.
> >> You want those items that have maintenance scheduled in the next (future)
> >> 30
> >> days.
> >>
> >> Field: DateDue
> >> Criteria: Between Date() and Date()+30
> >>
> >> If you want those that are overdue (for the last 30 days)
> >> Criteria: Between Date()-30 and Date()
> >>
> >> If you want those that are overdue at 30 or more days
> >> Criteria: <Date()-30
> >>
> >>
> >> "camilia" <(E-Mail Removed)> wrote in message
> >> news:F6984FCB-EEB7-4CDA-BE82-(E-Mail Removed)...
> >> > Hello,
> >> > I have a database that maintainthe equipments. I want to be able to run
> >> > a
> >> > report to show me all the equipments that are due within 30 days for
> >> > maintenance
> >> > Hope some bodyy can help me with that.
> >> > Right now on my query I have <30, which doesn't do anything:-(
> >> >
> >> > Thanks alot
> >> > --
> >> > camilia
> >> >
> >> >
> >> > "Bank" wrote:
> >> >
> >> >> I have a date/time field that I need to execute a date range search.
> >> >> The
> >> >> field always has a date, but may not have a time. When I execute a
> >> >> between
> >> >> date criteria I only get a few item when there are 100's in the range.
> >> >> Any
> >> >> sugestions?
> >> >>
> >> >> thanks
> >> >> Bank
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
John Spencer
Guest
Posts: n/a
 
      23rd Feb 2006
Well, in a way you are missing something. I had a typing error. I had an =
sign instead of a + sign. That error caused the computer to search for
everything between Feb 1 2006 and November 30, 2005.

Field: MaintDueDate
Criteria: Between DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())+1,0)



"camilia" <(E-Mail Removed)> wrote in message
news:0E43DFC1-1AC2-41D1-940F-(E-Mail Removed)...
> Hi John,
> Yes, when I run the report lets say on March 1st, I want to see all the
> equipments that are due in March and same thing in April
> I tried what you suggested to do, but it gave me all the records in
> December.
> Am I missing something???
> Thanks alot for your help
> --
> camilia
>
>
> "John Spencer" wrote:
>
>> So if you run the report in February of 2006 you want to show all
>> equipment
>> with a MaintDueDate in February and if you run the report in July 2007
>> then
>> you want all equipment with a MaintDueDate in July of 2007.
>>
>> If that is correct
>>
>> Field: MaintDueDate
>> Criteria: Between DateSerial(Year(Date()),Month(Date()),1) And
>> DateSerial(Year(Date()),Month(Date())=1,0)
>>
>> That will get every MaintDueDate record in the current month of the
>> current
>> year.
>>
>> "camilia" <(E-Mail Removed)> wrote in message
>> news:A3EFC1CB-7B53-4E7A-B7CC-(E-Mail Removed)...
>> > Thanks for your respond
>> > The MaintDueDate is set up as a text in my table
>> > I tried Between Date() and Date()+30 and it shows me one equiment that
>> > was
>> > due in Feb and couple equipments in March.
>> > I need to run a report every month to get all the equipments that are
>> > due
>> > in
>> > that month.
>> > I have been working on this for a long time and I am not getting
>> > anywhere:-(
>> > --
>> > camilia
>> >
>> >
>> > "John Spencer" wrote:
>> >
>> >> Do you have a datetime field that shows when maintenance is due?
>> >> Assumptions:
>> >> Datetime field that specifies date due for maintenance.
>> >> You want those items that have maintenance scheduled in the next
>> >> (future)
>> >> 30
>> >> days.
>> >>
>> >> Field: DateDue
>> >> Criteria: Between Date() and Date()+30
>> >>
>> >> If you want those that are overdue (for the last 30 days)
>> >> Criteria: Between Date()-30 and Date()
>> >>
>> >> If you want those that are overdue at 30 or more days
>> >> Criteria: <Date()-30
>> >>
>> >>
>> >> "camilia" <(E-Mail Removed)> wrote in message
>> >> news:F6984FCB-EEB7-4CDA-BE82-(E-Mail Removed)...
>> >> > Hello,
>> >> > I have a database that maintainthe equipments. I want to be able to
>> >> > run
>> >> > a
>> >> > report to show me all the equipments that are due within 30 days for
>> >> > maintenance
>> >> > Hope some bodyy can help me with that.
>> >> > Right now on my query I have <30, which doesn't do anything:-(
>> >> >
>> >> > Thanks alot
>> >> > --
>> >> > camilia
>> >> >
>> >> >
>> >> > "Bank" wrote:
>> >> >
>> >> >> I have a date/time field that I need to execute a date range
>> >> >> search.
>> >> >> The
>> >> >> field always has a date, but may not have a time. When I execute
>> >> >> a
>> >> >> between
>> >> >> date criteria I only get a few item when there are 100's in the
>> >> >> range.
>> >> >> Any
>> >> >> sugestions?
>> >> >>
>> >> >> thanks
>> >> >> Bank
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract date from date/time field in query used with mailmerge. Pat B Microsoft Access Queries 3 2nd Jun 2009 09:23 PM
RE: Access query on date/TIme field for date then there is no time? =?Utf-8?B?S0FSTCBERVdFWQ==?= Microsoft Access Queries 0 4th Feb 2006 11:48 AM
How do I write a query to ignore the date in a date/Time field =?Utf-8?B?VGltIFQ=?= Microsoft Access Queries 3 26th Jun 2005 11:55 PM
Query date/time field access Rolf Microsoft ASP .NET 2 31st Jan 2005 08:51 PM
Simply querying date/time field for particular date with parameter query Brian Microsoft Access Queries 2 22nd Jan 2004 06:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 PM.