Changing the string after a fortnight

kupe

Registered User.
Local time
Today, 12:30
Joined
Jan 16, 2003
Messages
462
I'd like to have something like this in the VBA code, but I cannot think how an Immediate If like this should appear.

What it needs to do is to change a string after 14 days.

Help/advice would be appreciated.

Me!cboWork = IIf(Me!cboWork = “New” And (Date() – Me!txtDoA) >= 14, “Tainted”, Me!cboWork)
 
Code:
If Abs(DateDiff("d",Me!txtDoA,Date())) >= 14 AND Me!cboWork = "New" Then
  Me!cboWork = "Tainted"
End If
 
kupe,

This syntax is close to what you need, but it will only work for
the record currently on your form. You need to put it in an
update query (or better yet, not store "Tainted" at all since
you can easily calculate it).

Code:
Me.cboWork = IIf(Me.cboWork = "New" And (DateDiff("d", txtDOA, Date-14) >= 14), "Tainted", Me.cboWork)

Wayne
 
Thanks, Wayne, and ReAn, much appreciated. I'll take note of the advice, Wayne, and follow it. (I overlooked taking the opposite tack this time, but I can see this is perfect for it.) Cheers
 
Hi ReAn - That's perfect, and my first taste of an Abs Function. Thank you. It not only changes the text on the form, it's a permanent change too. I can see me using it quite a lot. Most grateful. Cheers
 

Users who are viewing this thread

Back
Top Bottom