stookie
Posts: 5
|
Posted: 09/25/2009, 4:52 PM |
|
Hi
I have been trying to get a simple code to auto delete any record that has expired i.e. the date field is 2 or more days older than today's date.
I would like this code to run every time someone views a particular page - the page in question displays a simple (non editable) grid showing a list of up and coming events and dates.
Can anybody help with this?
ASP pages, MS Access database
I'm am a bit of a newbie, if you could keep things simple would be great thanks.
|
|
|
cab33010
Posts: 26
|
Posted: 10/11/2009, 7:00 PM |
|
Does anyone have an answer to that question I also need the information?
Thanks
|
|
|
Oper
Posts: 1195
|
Posted: 10/11/2009, 7:45 PM |
|
The code for access is simple but 3 Question:
1) Are you planing to create a task that will run daily for this?
(You will need acceass to teh server)
2) or you guys planning to have a page you click and then the record will
be Deleted?
3) or just check on few pages that you normaly run daily?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
cab33010
Posts: 26
|
Posted: 10/11/2009, 8:15 PM |
|
I need to delete any record older then 365 days from my database when its viewed.
I was trying this code in the before show of my grid.
DELETE FROM [table_name] WHERE [Table_Field]< DaysAdd(day , -365 , date() )
DELETE FROM E58 WHERE Date < DaysAdd(day , -365 , date() )
I'm very green in this, Thank you in advance.
|
|
|
stookie
Posts: 5
|
Posted: 10/12/2009, 2:51 AM |
|
My needs are much the same as cab33010, I'm looking for a small code that will check my records every time a user clicks to view them and delete any that are out of date (past today's date), It's just to save me login in all the time to delete them, it would be nice if the out of date records removed themselves.
I have full access to my server if need be
Thanks
|
|
|
Oper
Posts: 1195
|
Posted: 10/12/2009, 9:15 AM |
|
Delete
FROM YourFile
WHERE now()-message_date > 365
Note: This is for Access Database Only
Note 2: This will be for the entery Table.
if you needd for an specific user you will have to filter by that user
Tokky if you have access to the server, i would suggest create a simple/small VBS script that run Daily at Night, or at some point of the day and will delete the old record. (we do this for our history tables and Logs)
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
stookie
Posts: 5
|
Posted: 10/21/2009, 11:32 AM |
|
Hi
Thanks for your help but I cant seem to get that line of code to work, I keep getting a VBScript error
DELETE FROM [table name here] WHERE now()-[date field here] >2
The error that comes up is "Microsoft VBScript compilation (0x800A0401) Expected end of statement" it seems to think that something is missing between the FROM and [table name here] in the code.
Access Database, the code is placed in Before Show Event in a Editable Grid
Thanks
|
|
|
Oper
Posts: 1195
|
Posted: 10/24/2009, 7:22 AM |
|
Could you post the code (complete code)
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|