Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 15th, 2003, 09:30 AM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameters in Queries

Hi,

just a quick one - in a query i have a few date fields but what i want my criteria to say is give me everything that is in between the following to dates.

Between Today at 9.00 and MyFieldName

Basically i have the myfieldname formatted the way i want but i am trying to work out how to say Today at 9.00 in my criteria?

any ideas?
 
Old September 15th, 2003, 04:01 PM
Authorized User
 
Join Date: Sep 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi al0468 -

I think what you are trying to do is qualify your query by setting a date parameter and further by a specific time. Try this code, this should work.

SELECT Table1.FieldName
FROM Table1
WHERE (((Table1.FieldName) Between #9/1/2003 9:0:0# And #9/1/2003 18:0:0#));

This queries table1 on the field fieldname between 9Am on 9/1 and 5Pm on 9/1.

HTH,
Sean


 
Old September 17th, 2003, 02:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To put the currnt date at 09:00 as a time, you have to remember that dates are actually stored as numbers, not dates, for example, at the time of writing, the current date is 37881 (which is 17 Sept 03) and the current date/time is 37881.7136458333 which to you and me is 17 Sept 03 17:07:39

So you could use the expression:
Date()+0.375

Since Date() is always today's date, and 0.375 is always 09:00, you'll always get the answer you want.

Steven "another swhite" White

I am a loud man with a very large hat. This means I am in charge





Similar Threads
Thread Thread Starter Forum Replies Last Post
Joining 3 Queries. rupen SQL Language 1 May 11th, 2006 11:35 AM
Help with VB/Queries jenniferD Access VBA 4 January 9th, 2006 12:15 PM
Combining Queries or results from 2 queries Ford SQL Server 2000 24 November 7th, 2005 08:54 PM
2 Queries in one script Mitch PHP Databases 8 December 2nd, 2003 01:59 PM
Queries xzvi0r Access 5 September 8th, 2003 10:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.