Date Question

  • Thread starter Thread starter David
  • Start date Start date
D

David

Is their a way to make the "delete record" command button not delete a
record unless the date is greater than the beginning of a new year,
for example;
say you had a table with information that was dated with the date
range"1/1/03 through 12/31/03" and you did not want it delete unless it was
the beginning of a new year"1/1/04", how would you make this argument
with-out specify the years(anotherwords not saying all of the years to come
like 2004,2005,2006,etc.).
This form that the button is on hopefully will last for (years(plural form))
 
Is their a way to make the "delete record" command button not delete a
record unless the date is greater than the beginning of a new year,
for example;
say you had a table with information that was dated with the date
range"1/1/03 through 12/31/03" and you did not want it delete unless it was
the beginning of a new year"1/1/04", how would you make this argument
with-out specify the years(anotherwords not saying all of the years to come
like 2004,2005,2006,etc.).
This form that the button is on hopefully will last for (years(plural form))

You'll need to use either a Delete Query run from a custom button, or
modify the VBA code in the "delete record" command button to call such
a query. You could use a criterion of

< DateSerial(Year(Date()), 1, 1)

on the datefield in the Delete Query (in addition to any other
criteria) to ensure that only records older than the first day of the
current year will be deleted.
 
-----Original Message-----
Is their a way to make the "delete record" command button not delete a
record unless the date is greater than the beginning of a new year,
for example;
say you had a table with information that was dated with the date
range"1/1/03 through 12/31/03" and you did not want it delete unless it was
the beginning of a new year"1/1/04", how would you make this argument
with-out specify the years(anotherwords not saying all of the years to come
like 2004,2005,2006,etc.).
This form that the button is on hopefully will last for (years(plural form))
Hi Daivd,

Consider using OnCurrent event to preform check.
Use the result of a comparison for example

If Year([field]) < Year(Now()) Then
me.allowdeletions=true
else
me.allowdeletions=false
end if

Luck
Jonathan
 
Back
Top