Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code Question (97)

    Is is possible to add code to code to quit running the code after a specified period.

    i.e. I have code to run certain procedures. I only want this code to work for 15 days, after that I want a message to appear saying...o something like...please contact so and so for further information..

    Can this be done and if so could someone point me in the right direction?

    Thanks
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Code Question (97)

    Yes, it is, by putting a date check in code something like this:
    <font color=448800>If Date < #4/15/2002# Then
    What ever code you need to run for the 15 days
    Else
    MsgBox "Please contact the HELPDESK for further info. . .",vbOK,"Call Help"
    End If</font color=448800>

    This assumes of course that the individual workstation has the computer clock in it set to something close to the correct data and time. Hope this helps.
    Wendell

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code Question (97)

    Thanks very much...works like a charm
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Code Question (97)

    If you want it to be automatic, you'll need to use a registry key to store the date the app was installed, which means you'll need a startup routine that checks for the existence of the key in the first place. If the key exists, it compares the date stored there with today's date to see if the allowed period has elapsed. If the key doesn't exist, it creates it.

    It gets more complicated than that because users will try tricks like setting the system date 50 years in the future, installing the software and then resetting the system date in an effort to avoid the limits you've built in. Wtest for that condition also, where today's date is less than the stored date.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •