A query that compares with the current date

G

Guest

I'm trying to write a query which finds all records where the current date is 30 days or more later than the field 'datesent'

WHERE (((tblJob.DateRecieved) Is Null) AND ((tblNonPayment.FirstReminderMade) Is Null) AND ((Date())>[tblJob]![DateSent]+'30'))

this isn't returning any records. Is the query correctly written, can anyone please help?
 
K

Kevin

Check your third condition. Date() can never be greater
than anything.

Kevin
-----Original Message-----
I'm trying to write a query which finds all records where
the current date is 30 days or more later than the
field 'datesent'.
WHERE (((tblJob.DateRecieved) Is Null) AND
((tblNonPayment.FirstReminderMade) Is Null) AND ((Date())>
[tblJob]![DateSent]+'30'));
this isn't returning any records. Is the query correctly
written, can anyone please help?
 
M

Martin

Did you try:

WHERE (((tblJob.DateRecieved) Is Null) AND
((tblNonPayment.FirstReminderMade) Is Null) AND
((Date()-[tblJob]![DateSent]>=30)));

Or just put: Date()-[tblJob]![DateSent]>=30 in the criteria field in query
design.

HTH.

Martin.


willx said:
I'm trying to write a query which finds all records where the current date
is 30 days or more later than the field 'datesent'.
WHERE (((tblJob.DateRecieved) Is Null) AND
((tblNonPayment.FirstReminderMade) Is Null) AND
((Date())>[tblJob]![DateSent]+'30'));
this isn't returning any records. Is the query correctly written, can
anyone please help?
 
M

Martin

I'm sorry I didn't read your query carefully, there's something not correct
about it.

I believe [tblJob].[DateSent] is a field in your query, if so try this:

WHERE (((tblJob.DateRecieved) Is Null) AND
((tblNonPayment.FirstReminderMade) Is Null) AND
(([tblJob].[DateSent])<=Date()-30));

Or just put Date()-30 in the criteria field in query design.

Sorry for the previous post.

Hop this one helps.

Martin.



Martin said:
Did you try:

WHERE (((tblJob.DateRecieved) Is Null) AND
((tblNonPayment.FirstReminderMade) Is Null) AND
((Date()-[tblJob]![DateSent]>=30)));

Or just put: Date()-[tblJob]![DateSent]>=30 in the criteria field in query
design.

HTH.

Martin.


willx said:
I'm trying to write a query which finds all records where the current
date
is 30 days or more later than the field 'datesent'.
WHERE (((tblJob.DateRecieved) Is Null) AND
((tblNonPayment.FirstReminderMade) Is Null) AND
((Date())>[tblJob]![DateSent]+'30'));
this isn't returning any records. Is the query correctly written, can
anyone please help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top