|
-
Aug 2nd, 2007, 11:04 AM
#1
Thread Starter
New Member
Grace Period past expire date
need help creating code for grace period. I have licenses that expire the last day of the month in a specified year(yyyy), and trying to start code on how to extend the grace period of 30 days past the due date (last day of ea. month) that they come due.
truly,
FRAZZED
-
Aug 2nd, 2007, 11:10 AM
#2
Re: Grace Period past expire date
Code:
If Now > DateAdd("m", 1, ExpireDate) Then
do something
End If
-
Aug 2nd, 2007, 11:28 AM
#3
Thread Starter
New Member
Re: Grace Period past expire date
TY for the help, much appreciated
If grace period = 30 days, do i declare that as
DIM GracePeriod As Date
GracePeriod=30 days //this is where i need help
How would I write the If statement?
-
Aug 2nd, 2007, 11:37 AM
#4
Re: Grace Period past expire date
If I read your original post correctly, you want it for 30 days past the expire date, which is at the end of the month. 30 days is roughly 1 month, so why not give then until the end of the next month? What this code does it runs the code if the date is any date past 1 month past the expire date.
Now, if you really and truly want to give them 30 days past the end of the month (which would not give them until the end of the next month,) Change this bit of code:
Code:
DateAdd("m", 1, ExpireDate)
to
Code:
DateAdd("d", 30, ExpireDate)
If you want to have a variable placeholder, then declare it as a constant at the top of the form/module, and use that instead.
PUBLIC CONST GRACEDAYS = 30
-
Aug 2nd, 2007, 11:48 AM
#5
Thread Starter
New Member
Re: Grace Period past expire date
The explanation helps alot. I will use the code:
DateAdd("m",1,ExpireDate)
Its simpler. Im getting it...thanks alot for your help.
-
Aug 2nd, 2007, 01:05 PM
#6
Re: Grace Period past expire date
Don't use Now() because the user can just set the date back on their computer. There was a good thread a few weeks ago on something along those lines. Some suggestions where storing it in the registery, getting from the web, etc.
I don't remenber how it ended but it had some good tips.
-
Aug 2nd, 2007, 01:15 PM
#7
Re: Grace Period past expire date
 Originally Posted by TysonLPrice
Don't use Now() because the user can just set the date back on their computer.
Good point. And, thinking back, I remember doing just that when I was a kid.
-
Aug 2nd, 2007, 01:32 PM
#8
Re: Grace Period past expire date
Okay, So I reworked that block a bit with some pseudo-code.
Code:
If Now > DateAdd("m", 1, ExpireDate) Then
Add key to registry that will lock the program until something unlocks it.
End If
And:
Code:
key = Getregistrykey
if key = locking value then
Give message to user describing locked situation and what he/she
can do about it.
Only allow access to main, options, and about forms.
exit sub
end if
-
Aug 2nd, 2007, 04:29 PM
#9
Thread Starter
New Member
Re: Grace Period past expire date
Well I tried a few things, Im unable to store in the registry and get from the web. If expire date is end of the month, they cant renew. I want to allow the license renewal within the 30 days. Once they are pass the 30 day grace period, they cannot renew license. I have If now > dateadd("d", 30, Expiredate) Then they cant renew. Can I take the expire date, add (30 days) and then say they cant renew. More help
-
Aug 2nd, 2007, 07:23 PM
#10
Re: Grace Period past expire date
 Originally Posted by VB_Starter
Well I tried a few things, Im unable to store in the registry and get from the web. . . . . Can I take the expire date, add (30 days) and then say they cant renew. More help
Here is a link to a thread from a few years ago that contains a module that will allow you to read/write from/to the registry. Be sure to comment where/who you got it from. 
http://www.vbforums.com/showthread.p...light=registry
Once you have the registry handling worked out, then you can take your approach and deny the renewals.
-
Aug 3rd, 2007, 04:32 AM
#11
Re: Grace Period past expire date
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|