Results 1 to 12 of 12
  1. #1
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272

    Setting a trial version of my database

    I have a database which i will like to set a trial version for users to use after which they will not able to use the database when the time is over .
    i googled and found these codes which i have tried and still not working.

    i applied them on the onload event of the login form

    "If Now() - 10 > CDate("2/7/2021") Then
    MsgBox "Yo!"


    DoCmd.Close acForm, Me.frm_login, acSaveNo
    End If"


    What didnt i do right. Kindly help.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,245
    Have you tried debug.print on those values to see what it produces?

    Code:
    ? Now() - 10
    22/06/2021 12:39:59 
    ? CDate("2/7/2021")
    02/07/2021
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by Welshgasman View Post
    Have you tried debug.print on those values to see what it produces?

    Code:
    ? Now() - 10
    22/06/2021 12:39:59 
    ? CDate("2/7/2021")
    02/07/2021
    how do i do that?

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,245
    Go into the Immediate window (Ctrl + G)
    then type in ? and whatever variables you are using?

    You can see from the above where I have done that, and the result is on the next line.

    That shows you what those values are?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    use date math: DateAdd() or DateDiff()

    or just say
    if DAte() > #12/1/2021# then docmd.quit

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,368
    It is difficult to enforce trial versions of Access because it's so hackable. Not saying I'm great at it, but if you get this working and want someone to test whether or not your efforts can be overcome, post an expired version and we'll see if it can be opened and used.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Quote Originally Posted by ranman256 View Post
    use date math: DateAdd() or DateDiff()

    or just say
    if DAte() > #12/1/2021# then docmd.quit
    Interesting code
    Let me try it out and see

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,245
    There is nothing wrong with your approach if you get your logic correct?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,841
    Be aware that dates need to be in us format . 2/7 could be interpreted as 7th feb

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,120
    If you are going to do this, I suggest you also check for anyone changing the system date using the code provided in an earlier thread of yours Correct system date before database can start successfully (accessforums.net)
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,245
    Quote Originally Posted by isladogs View Post
    If you are going to do this, I suggest you also check for anyone changing the system date using the code provided in an earlier thread of yours Correct system date before database can start successfully (accessforums.net)
    I was going to suggest that to test the o/p's code logic.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    Emmanuel is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2020
    Posts
    272
    Well noted guys. Thanks for your suggestions

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Publish Trial Version
    By RustyRick in forum Access
    Replies: 3
    Last Post: 04-02-2020, 01:15 PM
  2. Replies: 7
    Last Post: 02-05-2018, 08:14 PM
  3. Access trial version?
    By RhinoCan in forum Access
    Replies: 3
    Last Post: 06-13-2015, 05:56 AM
  4. Valitation Date fot Trial Version
    By gstylianou in forum Access
    Replies: 2
    Last Post: 12-31-2013, 03:17 PM
  5. connecting to odbc with a trial version
    By tfurubay in forum Access
    Replies: 0
    Last Post: 03-20-2012, 11:42 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums