That link worked for me. Thanks. I'm sure this is a stupid question, but how do I increase the version so it knows to update it?
That link worked for me. Thanks. I'm sure this is a stupid question, but how do I increase the version so it knows to update it?
You need to copy the usysVersion table into the front-end. To see it go to File/Options/Current Dtaabase/Navigation and turn on (check) system objects. Usually I create a form (frmVersion is included in the launcher) that I embed in a switchboard of some sort that stays open so the user knows what version they have (I also put the version number and revision date in the application title).
You can PM me if you need more help.
Cheers,
This may not be relevant as you are using Vlad's updater but my own updater checks three things in the local and network copies
1. The version number in a version.txt file
2. The version number in a local settings table in the FE
3. The date modified of the program file.
If any of those indicate the network file is newer, the update runs.
I also use Windows API to manage file copying as it is far faster and, if necessary, can be paused or cancelled.
See this post from earlier todayhttps://www.access-programmers.co.uk...3&postcount=18
Yes Colin, I also use Windows APis for the file copying:
I can see the first two options being safe but wouldn't the third (date modified) be a bit of a liability in case some one opens/ modifies the network version by mistake?Code:Option Compare Database Option Explicit Const FO_COPY = &H2 Const FO_DELETE = &H3 Const FO_MOVE = &H1 Const FO_RENAME = &H4 Const FOF_ALLOWUNDO = &H40 Const FOF_SILENT = &H4 Const FOF_NOCONFIRMATION = &H10 Const FOF_RENAMEONCOLLISION = &H8 Const FOF_NOCONFIRMMKDIR = &H200 Const FOF_FILESONLY = &H80 Private Type SHFILEOPSTRUCT hwnd As Long wFunc As Long pFrom As String pTo As String fFlags As Integer fAborted As Boolean hNameMaps As Long sProgress As String End Type #If VBA7 And Win64 Then 'x64 Declarations Private Declare PtrSafe Function SHFileOperation Lib "shell32.dll" _ Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long #Else 'x32 Declaration Private Declare Function SHFileOperation Lib "shell32.dll" _ Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long #End If Public Function vcCopyFIle(sSource As String, sDest As String) Dim lFileOp As Long Dim lresult As Long Dim lFlags As Long Dim SHFileOp As SHFILEOPSTRUCT lFileOp = FO_COPY lFlags = lFlags Or FOF_NOCONFIRMATION lFlags = lFlags Or FOF_SILENT With SHFileOp .wFunc = lFileOp .pFrom = sSource & vbNullChar & vbNullChar .pTo = sDest & vbNullChar & vbNullChar .fFlags = lFlags End With lresult = SHFileOperation(SHFileOp) End Function
Also just curious if yours keeps a copy of the local file in case the user modified any objects (mainly queries) that could be imported into the newer version?
Cheers,
Vlad
Hi Vlad
Sorry. Only just read your reply.
That's similar API code to 'mine' (probably both taken from the same source) but two points regarding your conditional compilation (CC)
1. You also need to apply CC to the 2 pointers in the Type part of the declaration
2. There is no need to use Win64. VBA7 covers both bitnesses in A2010 or later
In fact if all users, have a minimum of A2010, just use the VBA7 version of the CC
My version of the code is in the link in post #18
Regarding the date modified check, I instruct my clients to keep the upgrade folder locked down on the server so only the program admins have access to it.
Also to ensure files in that folder are NEVER opened directly from that location.
I've used the system since 2005 with multiple clients without any issues.
However, that check could just be omitted if not appropriate for any reason.
Thanks Colin, I just made the change to include the Type pointers (as LongPtr for 64 bit) yesterday...
Cheers,