DB's updating automaticly

Results 1 to 2 of 2

Thread: DB's updating automaticly

  1. #1
    Join Date
    Dec 1969

    Default DB's updating automaticly

    Is there any way I can have a Access DB field update itself once a certain condition is met.<BR><BR>Say I have a DateStart Field. And I will say<BR><BR>If DateStart = DateStart + 30 &#039; this would mean the record has been in the db for a month<BR><BR>Then Mark an "Expired" Field to "YES"<BR><BR>Can this happen automatically, or would I HAVE to develop a script that I would have to run to mark all Fields as Expired once the DateStart field is greater than or equal to DateStart + 30.<BR><BR>ANy ideas?

  2. #2
    Join Date
    Dec 1969

    Default Yes and no...

    You have to run a program, but the SQL to do this is trivial.<BR><BR>And you could write the program in VBScript (NOT ASP!) and execute it via Windows Script Host (WSH--see http://msdn.microsoft.com/scirpting). You just schedule the script to run once per day, say in the middle of the night. (Same way you schedule, say, disk cleanup once a day or once a week, from control panel.)<BR><BR>Incidentally, you will *NEVER* find any records that pass this test:<BR> If DateStart = DateStart + 30 <BR><BR>You meant, of course, <BR> If Date() = DateStart + 30 <BR><BR>And the SQL is trivial:<BR> UPDATE yourTable SET Expired=True WHERE Date() &#062;= DateAdd(&#039;d&#039;,30,DateStart)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts