Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Posts
    156

    Unanswered: Prevent Back-end Access from Earlier Versions

    Good day turkeys and turkettes:

    Primarily, I'm wanting to know if there's any way that I can use the version of my front-end to either limit or allow access to a back-end.

    First off, how do you assign a version number to a certain front-end? Then, how would you implement the code in the back-end to determine whether or not the version is too old?

    If this is the wrong way to go about doing this, please show me a more excellent way! Thank you very much in advance!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  2. #2
    Join Date
    Sep 2003
    Posts
    228
    I have a table in my backend that stores the latest revision number.

    In my frontends I have a particular form that opens when the front-end is launched. In that form's onopen event I see if a hard coded version number from the frontend matches the value from the table in the backend.

    If there's a match then it is business as usual.

    If the version number from the frontend is older than the version from the backend then I copy the latest frontend to the users machine.

  3. #3
    Join Date
    Jul 2004
    Posts
    156
    Where do you place the hard coded version number in the frontend? A property of the database or something along those lines?

    And I assume that you use VB code to copy the frontend to the users machine. Could you give me an example of your code that does that? Or at least, in general terms, what you do in that code? What I do is use a program (like Inno Setup) to compile an installation file that lets them pick where to install it, desktop icon, etc. Then, whenever a new version is released, an e-mail is sent out to the users with a link to the setup file. It runs it and off they go.

    I guess I'm most interested in how to compare version numbers. I guess there's a plethora of options of where to put the version number in the front-end. Your suggestions would be appreciated! Thanks!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  4. #4
    Join Date
    Sep 2003
    Posts
    228
    In the onopen event of the form I was talking about I put in code along the lines of:
    Code:
     if dlookup([version_number], version_table) <> 1.0 then
      'propmpt user that their frontend is out of date and ask them if they wish to auto update their version...
      'quit
    else
       'continue as normal
    endif
    I don't use this version number elsewhere so there is only one place to change it. I update this line of code for each release of my front end. If you need to use the version number elsewhere I would recommend a variable to hold the value so there is one central place to change the value.

    I don't have the code in front of me for how I copy the .mdb file to the user's machine. I could get back to you on Monday if you need it.

    Basically, I just copy the .mdb file to the same directory as the obsolete one. I then prompt the user to delete the old file and update any shortcuts they have created.

  5. #5
    Join Date
    Jul 2004
    Posts
    156
    I would appreciate that code if it's not too much of a hassle. Mainly, I'd like to compare to see how much different it would be from the way I'm doing it now. I'd like to know if it'd be easier for them or not since the people who would be using it aren't exactly computer savvy. Thanks!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  6. #6
    Join Date
    Sep 2003
    Posts
    228
    Quote Originally Posted by DocX
    I would appreciate that code if it's not too much of a hassle. Mainly, I'd like to compare to see how much different it would be from the way I'm doing it now. I'd like to know if it'd be easier for them or not since the people who would be using it aren't exactly computer savvy. Thanks!
    In the form open event of the my first form that opens (automatically) I check to see if the frontend's version is equal to the latest version number (stored on the backend). If the version's are not the same then I run the following code:

    Code:
            MyPath = CurrentDb.Name ' This will be the path and the file name of the user's frontend.
            MyFile = Dir(MyPath) 'This is the name of the frontend file.
            CurrentDBDir = Left$(MyPath, Len(MyPath) - Len(MyFile)) 'This will just be the folder on the user's machine.
        
            Sourcefrontend = "\\Server1\MyDB\frontend\*.mdb"
            Targetfrontend = CurrentDBDir
        
            NewFE = Dir(Sourcefrontend) 'gets name of the .mdb file on \\Server1\MyDB\frontend\
        
            s = "You Are Not Running the Correct Version of the Database Frontend, Version " & FrontendVersion & "." & vbCrLf & vbCr
            s = s & "A new frontend will be placed in the following folder:" & vbCrLf
            s = s & CurrentDBDir & vbCrLf & vbCr
            s = s & "You can then create a shortcut to the new frontend -- " & strNewFE & " -- if you wish and remove the prior version of the frontend from your computer." & vbCrLf & vbCr
            s = s & "Do you wish to update now?  If you choose NO, your frontend will exit and you will have to upgrade later."
        
            Answer = MsgBox(s, vbYesNo, "INCORRECT FRONTEND VERSION")
       
            If Answer = vbNo Then 'if they click No
                DoCmd.Close
                DoCmd.Quit
            End If
            DoEvents
            DoCmd.Hourglass True
            Set fs = CreateObject("Scripting.FileSystemObject")
            fs.CopyFile Sourcefrontend, Targetfrontend
            fs.CopyFile MouseDLL, Targetfrontend
            Set fs = Nothing
            DoCmd.Hourglass False
        
            s = "The correct version of the database frontend has been placed on your computer in the following folder:" & vbCrLf & vbCr
            s = s & CurrentDBDir & vbCrLf & vbCr
            s = s & "You can now create a shortcut to - " & NewFE & " - to launch the new PCAD database if you wish. Click OK to close this frontend."
            MsgBox s, vbOKOnly, "FRONTEND COPY IS COMPLETE"
            DoCmd.Close
            DoCmd.Quit
    Hope this helps you guys... My messages to the users may be a little too verbose for some but, that is something easily changed. The heart of this code starts with the DoEvents command.

Posting Permissions

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