Solved

Please Help with...How to subtract datefield from Date()

Posted on 2006-11-30
1
194 Views
Last Modified: 2013-12-24
I have been trying to write a query to pull from a field called date_open - Date().  What I want to see is when the date_open is over 21 days due I want the query to show just those records.  The other criterial are they need to be open or pending only. The below script is what I have worked with for the past 2 days with no avail.  Can someone please just look at it and lead me in the right direction.  Thanks in advance for all your help.

The error is listed also below.

SELECT ticket_Table1.date_open, ticket_Table1.tkt_id, ticket_Table1.service_tkt_status

FROM ticket_Table1

WHERE ((date_open<[# & Date()-21 & #])) AND ((ticket_Table1.service_tkt_status)='Open' Or (ticket_Table1.service_tkt_status)='Pending Approval')
ORDER BY ticket_Table1.tkt_id DESC;

I looked this error up and I made sure all the fields are spelled the same:

Database Results Error
Description: No value given for one or more required parameters.
Number: -2147217904 (0x80040E10)
Source: Microsoft JET Database Engine
0
Comment
Question by:bburden
1 Comment
 
LVL 16

Accepted Solution

by:
CWS (haripriya) earned 225 total points
ID: 18052305
SELECT ticket_Table1.date_open, ticket_Table1.tkt_id, ticket_Table1.service_tkt_status

FROM ticket_Table1

WHERE (ticket_Table1.date_open< Date()-21 ) AND ((ticket_Table1.service_tkt_status)='Open' Or (ticket_Table1.service_tkt_status)='Pending Approval')
ORDER BY ticket_Table1.tkt_id DESC;

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now