PC Review


Reply
Thread Tools Rate Thread

Date/Time in a query

 
 
=?Utf-8?B?S0xhdw==?=
Guest
Posts: n/a
 
      20th Nov 2006
I have an Acess DB with linked SQL tables using ODBC. I am trying to run a
query which uses a form to specify criteria. Here's the criteria in the Date
field:

Between [Forms]![frmChooseReqDate]![StartDate] And
[Forms]![frmChooseReqDate]![EndDate]

The Date field is date/time - and will only return data if I type in exact
times. I want to be able to enter just a date and get all times for that
date. I'm sure it can be done using wildcards, but I don't know the correct
syntax for the above criteria.

Any help is appreciated!
 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      20th Nov 2006
Take a look at the DateValue() function (if I recall correctly).

Regards

Jeff Boyce
Microsoft Office/Access MVP

"KLaw" <(E-Mail Removed)> wrote in message
news:CEE4C04F-9974-4BCC-9FFA-(E-Mail Removed)...
>I have an Acess DB with linked SQL tables using ODBC. I am trying to run a
> query which uses a form to specify criteria. Here's the criteria in the
> Date
> field:
>
> Between [Forms]![frmChooseReqDate]![StartDate] And
> [Forms]![frmChooseReqDate]![EndDate]
>
> The Date field is date/time - and will only return data if I type in exact
> times. I want to be able to enter just a date and get all times for that
> date. I'm sure it can be done using wildcards, but I don't know the
> correct
> syntax for the above criteria.
>
> Any help is appreciated!



 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      20th Nov 2006
On Mon, 20 Nov 2006 09:26:02 -0800, KLaw wrote:

> I have an Acess DB with linked SQL tables using ODBC. I am trying to run a
> query which uses a form to specify criteria. Here's the criteria in the Date
> field:
>
> Between [Forms]![frmChooseReqDate]![StartDate] And
> [Forms]![frmChooseReqDate]![EndDate]
>
> The Date field is date/time - and will only return data if I type in exact
> times. I want to be able to enter just a date and get all times for that
> date. I'm sure it can be done using wildcards, but I don't know the correct
> syntax for the above criteria.
>
> Any help is appreciated!


Your Date Field includes a Time value.
Therefore any data past 00:00:00 AM of the [EndDate] is not within the
Between [FromDate] And [EndDate] criteria.

Easiest work-around is to just add one day manually to the [EndDate]
when prompted, i.e. instead of entering 11/24/2005 enter 11/25/2005.

A better work-around would be to set
[FromDate]
and
[EndDate]
and their expected Datatype as query parameters in the Query Parameter
Dialog (Click Query + Parameter).
Then change your criteria to:
Between [FromDate] and ([EndDate] + 1)

The best solution, if the Time of day is not necessary elsewhere, is
to run an Update Query to remove the time value from the date:

Update YourTable Set YourTable.[DateField] = DateValue([DateField]);

Then make sure the time is not included in any new record entries by
use Date() instead of Now() as the value entered.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
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
MS Access metadata repository generation query, matrix generationquery, table-generation query, array-generation query. Roy Roebuck Microsoft Access Database Table Design 1 20th Dec 2008 08:23 PM
i have two query q1, q2.both query use sub query.can i join both =?Utf-8?B?bmlraGls?= Microsoft Access Queries 1 7th Aug 2007 06:44 AM
Set sub (embedded?) query parameters using VBA, call sub query in primary query with parameters completed Kelii Microsoft Access 4 5th Feb 2007 04:01 AM
verfiy a query like Query Analyzer's parse query function =?Utf-8?B?a2V2aW4=?= Microsoft C# .NET 1 24th Dec 2005 02:33 AM
Problem with .Background Query option of ODBC Query =?Utf-8?B?U2hpbHBz?= Microsoft Excel Programming 0 19th Apr 2004 06:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:29 PM.