?
Solved

Access query that uses a dynamically created date

Posted on 2008-06-26
2
Medium Priority
?
226 Views
Last Modified: 2013-11-27
I apologize if the question title wasn't appropriately named, but it was hard to try to come up with the words.

I want to create an Access query that deletes any record in a table that is older than 30 days ago from the current date.

I'm familiar with writing SQL statements, but not one that would use a variable type element as with this example.

Is there a way to do this in Access?
0
Comment
Question by:zrancidr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
jmoss111 earned 1000 total points
ID: 21875094
If you have some date in the table that contains the reference date then "DELETE * FROM MyTable WHERE MyDate < Date() - 30;"
0
 

Author Closing Comment

by:zrancidr
ID: 31470968
I should have just gone ahead and tried to do that myself...that was my initial inclination.  Thanks!!
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

765 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