473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to use Date in criteria

101 100+
I want to filtre a form to show only records <= current date and have the following SQL for the form

Expand|Select|Wrap|Line Numbers
  1. SELECT tblRoomsBooking.BookLocation, tblRoomsBooking.BookStartDate, tblRoomsBooking.BookTime, tblRoomsBooking.BookEndTime, tblRoomsBooking.BookName, tblRoomsBooking.Faculty, tblRoomsBooking.myID
  2. FROM tblRoomsBooking
  3. WHERE (((tblRoomsBooking.BookStartDate)<=Date()))
  4. ORDER BY tblRoomsBooking.BookLocation, tblRoomsBooking.BookStartDate;
  5.  
I have no complie error but the form does not appear to filtre the records according to my criteria?
Oct 27 '11 #1

✓ answered by NeoPa

In that case I see no reason why any valid data would fail to behave as you'd expect.

Can you explain what you see more clearly? Perhaps with data examples showing records that behave one way when you'd expect them to behave differently.

4 1455
NeoPa
32,556 Expert Mod 16PB
What type of field is tblRoomsBooking.BookStartDate?

Your code will fail unless the field type is DateTime.
Oct 27 '11 #2
Cyd44
101 100+
The field is set to Date/Time as a short date
Oct 27 '11 #3
NeoPa
32,556 Expert Mod 16PB
In that case I see no reason why any valid data would fail to behave as you'd expect.

Can you explain what you see more clearly? Perhaps with data examples showing records that behave one way when you'd expect them to behave differently.
Oct 27 '11 #4
Cyd44
101 100+
The SQL is contained within the Form as Control source and under the BookStartDate field I have added criteria as <= Date()

The Records were showing dates less that Date() and I am a total DUMMY for not realising it was working as intended. I wanted records in advance of today and should have had >= Date() not the way I had set it.

Sorry for wisting your time, it was working as coded, I simply had not realised that.
Oct 27 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: David B | last post by:
I have 2 querys with the following in the date criteria Between DateAdd("m",-6,(!!)) And (!!) Between DateAdd("m",-24,(!!)) And DateAdd("m",-6,(!!)) Problem is they both look at the same...
2
by: Rene | last post by:
I have a master "attendance" report that also has two "attendance" sub-reports...each collecting data from a different group...and totaling those present at the end. I chose sub-reports because...
2
by: ljn | last post by:
Hello, I'm trying to build a query to retrieve all records where a certain date is older than 120 days. I tried doing > 120 in the critera box for that date, but it's not working. Any ideas? ...
1
by: Mark | last post by:
Hi All, Below is part of a Union query which I can't get to work. I have a pop-up form which asks the user to enter a date and select from 2 option buttons. Once they have done this, the query...
10
by: Daniel | last post by:
In Microsoft Access I can write a query that includes the criteria: Between Date()-7 And Date() to retrieve the records from a table that fall within the last week. I'm trying to write a...
0
by: zeusspandex | last post by:
Im creating a cross tab query which sorts via and sums the for each type of . I want to be able to add a date criteria, so the user can specify that the query processes data between two dates. ...
1
by: zeusspandex | last post by:
Hi, i have the following SQL query and would like to add date criteria to it. the field being from the table and the criteria being Between !! And !! query: SELECT , ...
2
by: kashif73 | last post by:
Hi, I want to export data from 4 Access tables to Excel using VBA. The user selects 2 different DATES from the form & based on DATEs criteria all record from 4 tables should be extracted to...
5
by: sh55555 | last post by:
I have built a query in Access using the DateSerial function to convert dates such as 20100401 to 04/01/2010. The query results work fine and the date is displayed correctly. I am now trying to...
9
by: Raza Zahur | last post by:
Hi all, I've googled and googled but I can google no more, so I am here to ask for help on an issue I am having. I have a macro that runs a series of queries. Before the macro can be run, the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.