Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / September 2004

Tip: Looking for answers? Try searching our database.

delete record if "date" < "today"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wax - 15 Sep 2004 06:43 GMT
I have a database which is updated from a web site form.
One of the manditor fields in the form is a "good till
date" field.  At present I'm sorting the database by this
field each day and manually deleting the records prior to
todays date.  Is it possible to have a record
automatically deleted when a "date" field is less
than "today"
Nikos Yannacopoulos - 15 Sep 2004 09:42 GMT
Wax,

Make a query on the table, and add the Good till Date field in the grid
(plus as amny others as you want, it's immaterial). In the first criterion
line under this field, type in the following expression:
<Date()
This query will return all fields where the said date is older than today;
switch to datasheet view to verify. Back to the design view, go to menu item
Query > Delete Query. Running the query now (Query > Run while in design
view, double-clicking in the db window) will delete all the records
satisfying the criterion.
You could automate the process by setting up a simple macro with an
OpenQuery action, and naming the macro Autoexec. This will make the macro
run every time you open the database. Alternatively, you could use a command
button on a form (or a switchboard) to run the query whenever desired.

HTH,
Nikos

> I have a database which is updated from a web site form.
> One of the manditor fields in the form is a "good till
[quoted text clipped - 3 lines]
> automatically deleted when a "date" field is less
> than "today"
Wax - 16 Sep 2004 00:25 GMT
Nice one Nikos.  Exactly what I needed.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.