K
kimb via AccessMonster.com
I have searched Access Monster and I have been unable to answer my question.
I am trying to come up with a formula to put in my query that would remove
records based on my field "Date Scanned". I need to remove the last 3 days,
including today. One of my problems is the weekend. If it is Monday then I
would need it to delete, Thursday, Friday, Saturday, Sunday and Monday. If it
is Tuesday, I would need to delete, Friday, Saturday, Sunday, Monday and
Tuesday, and then on Wednesday, I would delete, Monday, Tuesday, Wednesday,
and so on.
I found this in Access Monster: IIf(Weekday(Date())=2,DateDiff("d",-3,Date()),
DateDiff("d",-1,Date())). This was used to do almost the opposite. It was to
keep yesterday and today's data and delete the rest. I have tried to
manipulate this for my purposes, but I have been unable to figure it out.
Any help would be greatly appreciated!
Kim
My Query (Table contains same)
Tracking Number Date Scanned Time Day Activity
Location
1Z2222222222222222 2/2/2010 5:39 AM Tue DESTINATION SCAN
EDMONTON, AB, CA
I am trying to come up with a formula to put in my query that would remove
records based on my field "Date Scanned". I need to remove the last 3 days,
including today. One of my problems is the weekend. If it is Monday then I
would need it to delete, Thursday, Friday, Saturday, Sunday and Monday. If it
is Tuesday, I would need to delete, Friday, Saturday, Sunday, Monday and
Tuesday, and then on Wednesday, I would delete, Monday, Tuesday, Wednesday,
and so on.
I found this in Access Monster: IIf(Weekday(Date())=2,DateDiff("d",-3,Date()),
DateDiff("d",-1,Date())). This was used to do almost the opposite. It was to
keep yesterday and today's data and delete the rest. I have tried to
manipulate this for my purposes, but I have been unable to figure it out.
Any help would be greatly appreciated!
Kim
My Query (Table contains same)
Tracking Number Date Scanned Time Day Activity
Location
1Z2222222222222222 2/2/2010 5:39 AM Tue DESTINATION SCAN
EDMONTON, AB, CA