A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date() Criteria



 
 
Thread Tools Display Modes
  #1  
Old February 26th, 2007, 02:40 PM posted to microsoft.public.access.queries
robbyp
external usenet poster
 
Posts: 4
Default Date() Criteria

Hello,

I have a basic query that is automated to export data into an Excel
spreadsheet. This query runs using the Date() function in the criteria field
to pull relevant records from that date. Now, I want to move this Date()
function to another field that is actually a DateTime field. This no longer
works.

Basically, how can I use something similar to the Date() function for a
DateTime field? Thanks.
  #2  
Old February 26th, 2007, 03:18 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Date() Criteria

Show us the SQL for what does and doesn't work. Open the query in design
view. Next go to View, SQL View and copy and past it here. Information on
primary keys and relationships would be a nice touch too.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"robbyp" wrote:

Hello,

I have a basic query that is automated to export data into an Excel
spreadsheet. This query runs using the Date() function in the criteria field
to pull relevant records from that date. Now, I want to move this Date()
function to another field that is actually a DateTime field. This no longer
works.

Basically, how can I use something similar to the Date() function for a
DateTime field? Thanks.

  #3  
Old February 26th, 2007, 03:26 PM posted to microsoft.public.access.queries
Michel Walsh
external usenet poster
 
Posts: 2,404
Default Date() Criteria

Hi,


also, your new date_time field MAY have a time portion. A comparison will
check and the date, and the time, to say there is an equality. Date() having
no explicit time, it is taken as 00:00:00 (midnight) for this purpose. So,
unless your field has a record with the same date, also at midnight, that
will be considered DIFFERENT. You can try:

.... WHERE DateValue(YourDateTimeField) = Date()


with DateValue removing the time part, if any is present. On the other
hand, that may be quite slow, if you have many records. Maybe preferable to
use:


.... WHERE YourDateTimeField BETWEEN Date() AND Date() + 1




Hoping it may help,
Vanderghast, Access MVP

"robbyp" wrote in message
...
Hello,

I have a basic query that is automated to export data into an Excel
spreadsheet. This query runs using the Date() function in the criteria
field
to pull relevant records from that date. Now, I want to move this Date()
function to another field that is actually a DateTime field. This no
longer
works.

Basically, how can I use something similar to the Date() function for a
DateTime field? Thanks.



  #4  
Old February 26th, 2007, 07:20 PM posted to microsoft.public.access.queries
mike
external usenet poster
 
Posts: 3,942
Default Date() Criteria

Date()+1

"robbyp" wrote:

Hello,

I have a basic query that is automated to export data into an Excel
spreadsheet. This query runs using the Date() function in the criteria field
to pull relevant records from that date. Now, I want to move this Date()
function to another field that is actually a DateTime field. This no longer
works.

Basically, how can I use something similar to the Date() function for a
DateTime field? Thanks.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:59 AM.


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