Automated addition of days in a duration field

aattas

Registered User.
Local time
Today, 13:47
Joined
Dec 24, 2014
Messages
75
Guys,
I have a field that calculates the expiry date once I entered the duration starting from the entry date as so:
Me.expirydate = date + duration

It's fine until I want to add 14 days to the duration if the expiry date is today. I tried as follows:
If me.expirydate=today then me.duration = [duration] + 14
Firts time it worked if I refreshed it. Then nothing happen.

Help & thanks
 
Try

If me.expirydate=Date() then me.duration = me.duration + 14
 
Then nothing happen.
In the vb window. Go to Tools, Option, Editor tab and select Require Variable Declaration. It will make your life easier.

The only way this would have done nothing without throwing an error would be because it thinks "today" is an undeclared variable. If variable declaration would have been required it would have thrown an error, the error would have been on the word Today, and it would have said "Sub or Function not defined" making it easy for you to debug.
Not declaring variables can mask a lot of issues.
 
Thanks man. I will try and let you know
Cheers
 
Hi . I tried the first choice and I did what u recommend. Now what. ? What I need to do for the duration change?

Thanks
 
I assume you're replying to MajP so I'll get out of the way.
 
Please it's the same system. If you can help I appreciate.
 
I offered code; I have no idea if you've tried it and if so what the result was.
 

Users who are viewing this thread

Back
Top Bottom