473,563 Members | 2,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query criteria for >today?

I want to query on a date field for any date after today's. I've tried
today and >date, but Access won't accept those. I Googled here, but couldn't find any reference to today's date except in VBA. I hope I don't have to write code in Access to query relative to the current, or any other, date.

Thanks!

Nov 13 '05 #1
6 40083
Use the Date() function in the Criteria row of your query, under your date
field, i.e.:
Date()
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"davegb" <da****@safebro wse.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .I want to query on a date field for any date after today's. I've tried
today and >date, but Access won't accept those. I Googled here, but
couldn't find any reference to today's date except in VBA. I hope I don't
have to write code in Access to query relative to the current, or any
other, date.

Thanks!

Nov 13 '05 #2

Allen Browne wrote:
Use the Date() function in the Criteria row of your query, under your date
field, i.e.:
> Date()


--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"davegb" <da****@safebro wse.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I want to query on a date field for any date after today's. I've tried
today and >date, but Access won't accept those. I Googled here, but
couldn't find any reference to today's date except in VBA. I hope I don't
have to write code in Access to query relative to the current, or any
other, date.

Thanks!


I tried that, tried it again after reading your reply. When I run the
query, I get an "undefined function date in expression" message. Any
other ideas?

Nov 13 '05 #3

"davegb" <da****@safebro wse.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .

Allen Browne wrote:
Use the Date() function in the Criteria row of your query, under your date field, i.e.:
> Date()
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"davegb" <da****@safebro wse.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I want to query on a date field for any date after today's. I've tried
>today and >date, but Access won't accept those. I Googled here, but
>couldn't find any reference to today's date except in VBA. I hope I don't>have to write code in Access to query relative to the current, or any
>other, date.
Thanks!


I tried that, tried it again after reading your reply. When I run the
query, I get an "undefined function date in expression" message. Any
other ideas?

Date() is not the same as >date. Be sure you put it on a criteria line by

itself with no quotes around it.

Nov 13 '05 #4
davegb wrote:
I want to query on a date field for any date after today's. I've tried
today and >date, but Access won't accept those. I Googled here, but couldn't find any reference to today's date except in VBA. I hope I don't have to write code in Access to query relative to the current, or any other, date.


Thanks!

If this were a dynamic query that you'd write, it might look something
like this
strSQL = "Select * From YourTableName " & _
Where DateField > #" & Date & "#"

You might want to open a code module and from the menu select the
References item. I have VisBasicForApps as the first item in the list,
the next being the MSAccess library.
Nov 13 '05 #5
On 18 Aug 2005 07:51:34 -0700, davegb wrote:
Allen Browne wrote:
Use the Date() function in the Criteria row of your query, under your date
field, i.e.:
> Date()


--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"davegb" <da****@safebro wse.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I want to query on a date field for any date after today's. I've tried
today and >date, but Access won't accept those. I Googled here, but
couldn't find any reference to today's date except in VBA. I hope I don't
have to write code in Access to query relative to the current, or any
other, date.
Thanks!


I tried that, tried it again after reading your reply. When I run the
query, I get an "undefined function date in expression" message. Any
other ideas?


It's >Date() WITH the parenthesis?
If that still gives you the "undefined function ..." message then
check your references for any marked 'Missing'.
Open any code window. Click Tools + References.
Uncheck any marked MISSING.
Exit and try the query again.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #6

fredg wrote:
On 18 Aug 2005 07:51:34 -0700, davegb wrote:
Allen Browne wrote:
Use the Date() function in the Criteria row of your query, under your date
field, i.e.:

> Date()

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"davegb" <da****@safebro wse.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I want to query on a date field for any date after today's. I've tried
>today and >date, but Access won't accept those. I Googled here, but
>couldn't find any reference to today's date except in VBA. I hope I don't
>have to write code in Access to query relative to the current, or any
>other, date.
Thanks!


I tried that, tried it again after reading your reply. When I run the
query, I get an "undefined function date in expression" message. Any
other ideas?


It's >Date() WITH the parenthesis?
If that still gives you the "undefined function ..." message then
check your references for any marked 'Missing'.
Open any code window. Click Tools + References.
Uncheck any marked MISSING.
Exit and try the query again.


That did it, Fred! Thanks!

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1413
by: Sunil Korah | last post by:
Hi, My table contains a date field "DateOfVisit" and I have the following query SELECT Patients.PID, Patients.Lastname, Patients.FirstName, Patients.DateOfVisit, Patients.ToReport FROM Patients WHERE (((Patients.DateOfVisit)>=GetStartDate() And (Patients.DateOfVisit)<=GetEndDate()))
1
2516
by: max | last post by:
I have about 20 different querys but they all have some fields that use the same expression. I would like to add criteria to those fields without opening every query individually. Plus this criteria changes frequently. Is there a macro that I could write where I can enter the criteria once and the macro inserts it into all the different...
2
1708
by: Glenn | last post by:
I'm trying to create a query that will show only the records that has a date of today or after in the date field (consequently my results would change everyday). I tried >=#today# but that didn't work. Is there a way to do this? If so how? Thanmks.
4
14391
by: Luongo | last post by:
I'm trying to construct a report based on a database query that retrieves the records from the current day as well as the day before. Can anyone explain the proper syntax for doing this? I tried using the DateDiff function but couldn't seem to get it working at all. Any help would be appreciated... thanks...
2
1766
by: Haas C | last post by:
Hey all, I created a Query (in Design View) which asks the user for an "As Of Date" which would then display relevant data. I put in the Criteria Row of the Query Design for the Date field. Is there anyway to put in a default of today's date in the input box and allow the user to change it to whatever they want? Please let me know if...
1
1510
by: vkong85 | last post by:
I am trying to write a query that will only display records between today's date and 30 days. I've tried several different ways but nothing seems to work. Currently in the criteria of the date column in the query i have the following code: Between (Date()) And (DateAdd("m",1,Date())) The logic behind this was that it would take all...
2
3924
by: cmartin1986 | last post by:
First of all I want to thank all of you that have helped me in the past this is an awesome fourm. My problem today is I have a database that builds charts that are viewed by a large group every friday morning. I am building six different charts that all have query criteria of between two dates right now I am going and updating the charts...
9
4112
by: darnnnel | last post by:
Hello everyone. i have a fom and subform (they are not linked).The subform has a date field named StartDate. i have a button on the form that when clicked will change the recordset of the subform to show StartDate of today. When i hit the command button, the subform becomes blank.Its driving me crazy.Here is my code: Private Sub cmdToday_Click()...
2
1773
by: darnnnel | last post by:
Hey guys. I have a form and subfrom. i have a button on the main form that when clicked sets the subform recorsource using a query in VBA. what i need is to find any records whos StartDate is either Saturday or Sunday. i was able to get another button to find records eqaul to Today using a variable, the code is pasted below - i cant figure out how...
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.