Automating FE updates (1 Viewer)

spudracer

Here and there
Local time
Today, 09:47
Joined
Jul 1, 2008
Messages
199
I currently have a fairly good sized (9 mb) database that I have shared with people. Upon initial installation, they are prompted to enter their local network data (basically where their copy of the database will be residing on their network).

As I make updates to the FE file, I make it available for them to download. So far, this works (for the most part).

I also have an installer file that pushes a copy of the FE file to each users desktop. The idea was for the first desktop install to be ran by them (using the install file saved on their network), with subsequent updates installing automatically upon them opening the database from their desktop.

Here is where I have a majority of the issues. Right now, if they open up their desktop version, it alerts them that they are not running the current version, the installer file then opens automatically while simultaneously closing their desktop version. This leads to some issues as the installer file hangs or the desktop version doesn’t close right away. Then, when the install has completed, it automatically opens the desktop version again which drops a run-time error.

Is there a way to simplify this process while still allowing the update to run? Are there some tried and true auto-update modules or code out there to speed the process up that won’t throw errors?
 

cajulien

New member
Local time
Today, 09:47
Joined
Feb 3, 2020
Messages
25
Hi Spud, I just spent some time with this last week: used the following insightful post
https://www.access-programmers.co.uk/forums/threads/auto-updater.303898/ , which I assume you'd read.

As per your specific question: I had similar issues and it came down to have a time delay between the Access quit and the file delete/copy; otherwise, Access doesn't have time to shut down before its file is overridden. I used the batch file approach to do the file actions so they use the ping trick to force the OS to wait a second (ping 127.0.0.1 -n 5 -w 1000 > nul), but I'm guessing it could be done without a batch file.

Hope this helps Spud, take care
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:47
Joined
Oct 29, 2018
Messages
21,357
Hi. I have tried different approaches to auto-updating the FE and currently settled on using a vb script to refresh the FE at each launch. It just seemed simpler this way.
 
Last edited:

bastanu

AWF VIP
Local time
Today, 06:47
Joined
Apr 13, 2010
Messages
1,401
Feel free to try my free db launcher (http://forestbyte.com/ms-access-utilities/fba-db-launcher/).

You need to have the code that checks the version in the launcher (installer) not the front-end itself. So the launcher checks the versions of both the local and master front-ends and if the same it opens the local copy, if the master's is higher then it backs up the local copy (in case the user made any changes to any objects that would be lost otherwise) then copies the master to the local folder and opens it.

Cheers,
Vlad
 

Cronk

Registered User.
Local time
Tomorrow, 00:47
Joined
Jul 4, 2013
Messages
2,770
One method to ensure the desktop FE is closed before proceeding with an update, is to check for the presence of the associated laccdb file
 

isladogs

MVP / VIP
Local time
Today, 13:47
Joined
Jan 14, 2017
Messages
18,186
My approach is to use a small 'starter app' run from the desktop or Start menu that looks like a splash screen to end users.
When it opens, it automatically checks for a new version of the main app on the network and:
1. If its the latest version, the main app is opened and the starter app closes
2. If a new version exists, this is automatically downloaded to the user's workstation, then it starts as above
File copying is done using a Windows API which is very fast.
The starter app can even update itself if a newer version is available

For further info, see the attached PDF file

In addition, my apps are distributed to clients via my website.
If a newer version is available for download, the program administrator is alerted automatically.
The code used to do this can be found here: Web Version Checker
 

Attachments

  • Using the SDA Updater.pdf
    498.6 KB · Views: 478

HiTechCoach

Well-known member
Local time
Today, 08:47
Joined
Mar 6, 2006
Messages
4,357
Hi. I have tried different approaches to auto-updating the FE and currently settled on using a vb script to refresh the FE at each launch. It just seemed simpler this way.

I am with theDBguy on this.

Keep it simple. Copy the Front end from the server to the local PC every time they open it. No need to check for a version, They always have a fresh and current copy.

Coping the front end every time is really important is you are not compiling the front end into a mde/accde.

I do check the version when the front end opens to be sure it matches the back end. This is a safeguard in case the front end is open not using the desired method.

I have come to this simple method from testing it with over 1,000 current desktops/users.
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 13:47
Joined
Jan 14, 2017
Messages
18,186
I've also tried the approach suggested by Boyd with multiple clients on thousands of workstations.
It certainly has its merits where users are able to modify the FE (but its better not to allow that)
The consensus from all my clients was that they didn't want to download a fresh copy every time they opened the FE as it created extra network traffic
In addition, end users didn't want to wait even a few seconds just to download the existing version.

Besides which, why allow users to edit the FE when each time they open it, any changes made will be overwritten

Instead, my clients distribute ACCDE FEs to users which are only updated when a new version is available or (rarely) when the FE gets corrupted.
Whether you use my 'starter app' or vbscript is irrelevant. Both are simple to use
 

zeroaccess

Active member
Local time
Today, 08:47
Joined
Jan 30, 2020
Messages
671
Hi. I have tried different approaches to auto-updating the FE and currently settled on using a vb script to refresh the FE at each launch. It just seemed simpler this way.
I do the same but with a txt file renamed to .bat. A shortcut to the .bat runs it minimized. It's all seamless because the FE is only 4 MB and transfers quickly. What does yours look like?

I do use an .accde file which is best practice, however I run through the program and open all forms and let all queries run at least once before placing it on the server. That way, each time they open the program and get a new copy, they get somewhat more optimized queries, rather than losing it all and getting a newly minted copy where the Access query optimizations haven't yet taken place.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:47
Joined
Oct 29, 2018
Messages
21,357
I do the same but with a txt file renamed to .bat. A shortcut to the .bat runs it minimized. It's all seamless because the FE is only 4 MB and transfers quickly. What does yours look like?

I do use an .accde file which is best practice, however I run through the program and open all forms and let all queries run at least once before placing it on the server. That way, each time they open the program and get a new copy, they get somewhat more optimized queries, rather than losing it all and getting a newly minted copy where the Access query optimizations haven't yet taken place.
Hi. I started out using a .BAT file, but I have since changed to using a VBS file now. I had an issue with using .BAT when our computers upgraded from XP to Win7. That's when I switched to using .VBS. I'll have to check what it looks like at work - I don't have a copy here at home. But if I remember it correctly, it's just a simple "copy network file to local machine, overwriting existing FE and then launch it." What I don't remember off the top of my head is what I am using to make sure the download has completed before launching the FE. I'll let you know tomorrow.
 

zeroaccess

Active member
Local time
Today, 08:47
Joined
Jan 30, 2020
Messages
671
Odd. I'm using .bat files on Windows 10 with no issues. You must have had a specific line or command that didn't work.

I don't think you need to check if the download has completed - I believe the START command won't run until the COPY is done.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:47
Joined
Oct 29, 2018
Messages
21,357
Odd. I'm using .bat files on Windows 10 with no issues. You must have had a specific line or command that didn't work.

I don't think you need to check if the download has completed - I believe the START command won't run until the COPY is done.
Hi. My original BAT worked fine on WinXP. When we upgraded the computers to Win7, it broke. When I fixed the .BAT file it worked on Win7 and WinXP. However, when I switched to VBS, it worked with Win7, and I didn't have to change anything when we moved up to Win10. You could be right, I may have something "bad" in the old BAT file, but I don't remember it now. All I can remember is it had something to do with user profiles and permissions (maybe think UAC - if I'm not mistaken, I think UAC started out with Win7 (XP didn't have it)).
 

zeroaccess

Active member
Local time
Today, 08:47
Joined
Jan 30, 2020
Messages
671
UAC started with Windows Vista, but I don't know why that would matter. Maybe it interfered - I wasn't working with Access back then so...

Just check if your destination folder exists - if not, create it, copy the file, then start.
 

shadow9449

Registered User.
Local time
Today, 09:47
Joined
Mar 5, 2004
Messages
1,037
I use a .bat as well to map the drive to the folder on the server containing the BE, transfer a new copy of the FE from the location on the server to the client workstation, then launch the app. I didn't like the black window so the desktop icon points to a simple .vbs file that says this:

CreateObject("Wscript.Shell").Run "C:\Somefolder\DBStarter.bat", 0, True

That makes the .bat run and you never see it.
 

zeroaccess

Active member
Local time
Today, 08:47
Joined
Jan 30, 2020
Messages
671
I use a .bat as well to map the drive to the folder on the server containing the BE, transfer a new copy of the FE from the location on the server to the client workstation, then launch the app. I didn't like the black window so the desktop icon points to a simple .vbs file that says this:

CreateObject("Wscript.Shell").Run "C:\Somefolder\DBStarter.bat", 0, True

That makes the .bat run and you never see it.
Set the properties of the shortcut to the .bat file to open Minimized and you won't see the command window.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 00:47
Joined
Jan 20, 2009
Messages
12,849
One method to ensure the desktop FE is closed before proceeding with an update, is to check for the presence of the associated laccdb file
It can get left lingering after crashing out of the database.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:47
Joined
Oct 29, 2018
Messages
21,357
UAC started with Windows Vista, but I don't know why that would matter. Maybe it interfered - I wasn't working with Access back then so...

Just check if your destination folder exists - if not, create it, copy the file, then start.
Ah, maybe we moved from XP to Vista then. It's been so long I already forgot it. Cheers!
 

shadow9449

Registered User.
Local time
Today, 09:47
Joined
Mar 5, 2004
Messages
1,037
Set the properties of the shortcut to the .bat file to open Minimized and you won't see the command window.

Indeed! I never realized you can set a shortcut that way now I see you can. Thanks for the tip :)

I still prefer to not have it show altogether but cool idea...
 

zeroaccess

Active member
Local time
Today, 08:47
Joined
Jan 30, 2020
Messages
671
Indeed! I never realized you can set a shortcut that way now I see you can. Thanks for the tip :)

I still prefer to not have it show altogether but cool idea...
This has me wondering. Can you add a line to a .bat file to set the title of the command window? Then, if your FE is huge or you are on a slow network (heaven forbid and good luck with Access), you could change the title to tell the user something, even if minimized.
 

isladogs

MVP / VIP
Local time
Today, 13:47
Joined
Jan 14, 2017
Messages
18,186
Indeed! I never realized you can set a shortcut that way now I see you can. Thanks for the tip :)

I still prefer to not have it show altogether but cool idea...

That's why I use the 'starter app' approach outlined in post #6. In both my opinion, and that of my clients, it looks more professional than showing a command window or vbscript. However, each to their own, all methods work.
 

Users who are viewing this thread

Top Bottom