• Code Question (97)

    Author
    Topic
    #368976

    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

    Viewing 1 reply thread
    Author
    Replies
    • #579630

      Yes, it is, by putting a date check in code something like this:
      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

      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.

    • #579636

      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.

    Viewing 1 reply thread
    Reply To: Code Question (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: