Error Split Database BobLarson's Auto Update FE

steve21nj

Registered User.
Local time
Today, 12:19
Joined
Sep 11, 2012
Messages
260
Running to a problem when i change the version number and relaunch the application.

My database:
LRSBudget.accde was the desktop file for the user.
LRSBudget.accdb on shared drive F:\Novermeber Test
LRSBudget_be.accdb on shared drive F:\Novermeber Test

Code:
See below, but it is located on the On_Load of my startup form.

Steps:
-I opened the database with no problems on the first run without making changes to the table.
-I went to a form, added a command button and changed the text, with no code behind it.
-Changed the version table tbl-fe_version to 1.0.2 from 1.0.1
-Changed the version table tbl-version_fe_Master to 1.0.2 from 1.0.1
-Double click LRSBudget.accde on desktop.
-Then produced error saying it cannot find LRSBudget.accde after it deleted the LRSBudget.accde icon.

Any suggestions?


http://www.btabdevelopment.com/ts/freetools

Code:
Private Sub Form_Load()
Dim strFEMaster As String
Dim strFE As String
Dim strMasterLocation As String
Dim strFilePath As String
' looks up the version of the front-end as listed in the backend
strFEMaster = DLookup("fe_version_number", "tbl-version_fe_master")
' looks up the version of the front-end on the front-end
strFE = DLookup("fe_version_number", "tbl-fe_version")
' looks up the location of the front-end master file
strMasterLocation = DLookup("s_masterlocation", "tbl-version_master_location")
' checks for the existence of an updating batch file and deletes it if it exists
    strFilePath = CurrentProject.Path & "\UpdateDbFE.cmd"
 
    If Dir(strFilePath) <> "" Then
        Dim fs As Object
        Set fs = CreateObject("Scripting.FileSystemObject")
        fs.DeleteFile (strFilePath)
        Set fs = Nothing
    End If
 
' if the current database opened is the master then it bypasses the check.
If CurrentProject.Path = strMasterLocation Then
    Exit Sub
 
Else
' if the version numbers do not match and it is not the master that is opened,
' the database will do the update process
    If strFE <> strFEMaster Then
        MsgBox "Your program is not the latest version." & vbCrLf & _
        "The front-end needs to be updated.  The program will " & vbCrLf & _
        "now close and then should reopen automatically.", vbCritical, "VERSION NEEDS UPDATING"
 
        ' sets the global variable for the path/name of the current database
        g_strFilePath = CurrentProject.Path & "\" & CurrentProject.Name
 
        ' sets the global variable for the path/name of the database to copy
        g_strCopyLocation = strMasterLocation
 
        ' calls the UpdateFrontEnd module
 
        UpdateFrontEnd
 
    End If
 
End If
End Sub
 

Attachments

  • Capture.PNG
    Capture.PNG
    28 KB · Views: 151
  • 3Capture.jpg
    3Capture.jpg
    59.8 KB · Views: 133
  • 4Capture.PNG
    4Capture.PNG
    7.2 KB · Views: 123
Okay, remember that you need to save a copy of the ACCDE file at

F:\November Test

because you have chosen that as your master location. You need to create the ACCDE file from the ACCDB file AFTER you have changed the version number and then make sure that ACCDE file is in that master location. The code looks for the file name of the file it just deleted. A common error is to not have the same named file at that master location.

So, you

1. Keep an ACCDB copy in a location where nobody normally has access. This is the file you work on.

2. When it is ready to be moved to production, you change the version number in the tables and make the ACCDE file and place that to F:\November Test (I assume that won't be the normal location but you also may try to use a file path without spaces in the name which could help).

3. The user then opens their file, it looks to the versions, if they don't match then it deletes the current one that is located at their location and then copies the file down. But if the file is there but isn't named the same it won't be able to find it.

Does that help?
 
Ok.

Basically I copy and replace the LRSBudget.accdb.
Update the table version numbers.
Then delete the LRSBudget.accde in the shared folder.
Recreate the accde.
And relaunch the desktop icon.

If those are the right steps, it is working for me. I changed the file name because I am testing, plus it was misspelled!

Also, can i just copy and paste the LRSBudget.accde to each desktop or do I have to create a specific one from the .accdb?

Thanks again!
 
Also, can i just copy and paste the LRSBudget.accde to each desktop or do I have to create a specific one from the .accdb?
You create ONE accde file from your accdb and then distribute to users initially. Once you have done that, remember to follow the procedure I laid out for you in my previous post. And, each user needs to have access to the master location (that's why we keep the copy we are working on somewhere else) so that it can copy the new file down.
 
Bob,

I have a follow up question. I know this idea would need to be done prior to copying the accdb and recreating the accde file but is there a way to include an update message when the user first logs on to the new version. Say you wanted to quickly highlight the version changes such as added reports or whatever the case may be.
Best regards,
 
You would want to make that the first form to pop up by using an autoexec macro which can call a function where you check to see if the flag has been set or not (save their option to not display again in a local frontend table) and if it has not been set, display that form and if it has been set don't. So you set the flag when they close the "what's new" form (set the value in the table to true) and then on subsequent times they open it, it won't show that form unless it is a new frontend from you.

Or you can set a custom property in the frontend.
 
Last edited:
You would want to make that the first form to pop up by using an autoexec macro which can call a function where you check to see if the flag has been set or not

I have been searching for a working sample of this but with no luck. Do you have something similar to this posted on your site or can direct me in the right direction.

Thank you
 
I have been searching for a working sample of this but with no luck. Do you have something similar to this posted on your site or can direct me in the right direction.

Thank you
I don't but the Northwind Database uses something similar only I believe it uses a property to keep from displaying again. If I get a chance I'll upload a sample but not sure how soon that will be.
 
Thats fine, I will take a look. I am more of a visual learner and need to see it in action to apply it. If you get a chance, great, if not I understand.
 
Here you go, written specifically for you.

Thanks Bob!

Easy to understand and replicate. One question, in a multiuser environment, by checking the box “Do not show again” will one users action of clicking effect every user who may not have logged in to see the update form?

For example Steve signs in first, checks the box to do not show again, Bob signs on shorter after, will bob see the form that steve unchecked?

Also considering the database is split, I’m using an .accde file for the users, and using your FE Utility to push updates.

If yes, how can I build a date counter for 5 days into VBA where the form will continue to show for five days beyond a date placed on the form?
 
Thanks Bob!

Easy to understand and replicate. One question, in a multiuser environment, by checking the box “Do not show again” will one users action of clicking effect every user who may not have logged in to see the update form?

Not if you do it correctly and put the table in the FRONTEND not in the backend.

For example Steve signs in first, checks the box to do not show again, Bob signs on shorter after, will bob see the form that steve unchecked?

Also considering the database is split, I’m using an .accde file for the users, and using your FE Utility to push updates.

If yes, how can I build a date counter for 5 days into VBA where the form will continue to show for five days beyond a date placed on the form?
Do you really want to make someone look at it for 5 days? I would just have the checkbox so that THEY can choose to not look at it again and, if they want, they can leave it unchecked and see it each time. But it would be their choice.
 

Users who are viewing this thread

Back
Top Bottom