Results 1 to 11 of 11

Thread: Grace Period past expire date

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    9

    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

  2. #2
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: Grace Period past expire date

    Code:
    If Now > DateAdd("m", 1, ExpireDate) Then
        do something
    End If

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    9

    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?

  4. #4
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    9

    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.

  6. #6
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    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.

  7. #7
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: Grace Period past expire date

    Quote 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.

  8. #8
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    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

  9. #9

    Thread Starter
    New Member
    Join Date
    Aug 2007
    Posts
    9

    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

  10. #10
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: Grace Period past expire date

    Quote 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.

  11. #11
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    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
  •  



Click Here to Expand Forum to Full Width