Updating the front end on local server

This is the batch file used for normal LAN operation.
Code:
md c:\DwgLog
del c:\DwgLog\DrawingLog.accdb
copy "\\BSCCTIMBERLINE1\Timberline Office\AccessApps\Data\CommonFE\DrawingLog.accdb" c:\DwgLog
c:\DwgLog\DrawingLog.accdb
This is the file used for Citrix or RDP oeration.
Code:
md %USERPROFILE%\DwgLog
del %USERPROFILE%\DwgLog\DrawingLog.accdb
copy "\\BSCCTIMBERLINE1\Timberline Office\AccessApps\Data\CommonFE\DrawingLog.accdb" %USERPROFILE%\DwgLog
%USERPROFILE%\DwgLog\DrawingLog.accdb

The difference is that you can hard-code the target locations if you are running on a standard LAN but with the other environments, you need to use the users personal directory as the target location.

As you can see, there is no error checking code in the script. None is actually needed. If the directory already exists, the md doesn't raise an error and for the del, if the file doesn't exist, that also doesn't raise an error. I've seen scripts that go on for pages but this is all I've ever needed.

Thanks Pat
 
Yes I am trying the code I posted and it does link the "tbl-version_fe_master" BUT it links it to the updater and not the intended FE
 
Then one of these must be wrong
strBEFile = Me.txtBackEnd
strFEFile = Me.txtFEMaster

But I'm with Gasman. Just make the darn link and sail away 🚤
 
Then one of these must be wrong
strBEFile = Me.txtBackEnd
strFEFile = Me.txtFEMaster

But I'm with Gasman. Just make the darn link and sail away 🚤
@pisorsisaac@gmail.co
That code is in Bobs updater, where he transfers his tables into one's FE & BE?
Obviously for it to work as the o/p wishes the code to create the link should be in his DB and have the correct values?
I do not think that is the case here.?

@oxicottin if you must persist with this, I would test for the table name in tabledefs and if not found link, but put that code in your DB.
 
Yeah but the controls txtBackEnd have to be holding the correct values, which I think may depend on the person using it.
I dunno, really..
 
This is the batch file used for normal LAN operation.
Code:
md c:\DwgLog
del c:\DwgLog\DrawingLog.accdb
copy "\\BSCCTIMBERLINE1\Timberline Office\AccessApps\Data\CommonFE\DrawingLog.accdb" c:\DwgLog
c:\DwgLog\DrawingLog.accdb
This is the file used for Citrix or RDP oeration.
Code:
md %USERPROFILE%\DwgLog
del %USERPROFILE%\DwgLog\DrawingLog.accdb
copy "\\BSCCTIMBERLINE1\Timberline Office\AccessApps\Data\CommonFE\DrawingLog.accdb" %USERPROFILE%\DwgLog
%USERPROFILE%\DwgLog\DrawingLog.accdb

The difference is that you can hard-code the target locations if you are running on a standard LAN but with the other environments, you need to use the users personal directory as the target location.

As you can see, there is no error checking code in the script. None is actually needed. If the directory already exists, the md doesn't raise an error and for the del, if the file doesn't exist, that also doesn't raise an error. I've seen scripts that go on for pages but this is all I've ever needed.

Hi Pat,

Love this code, works perfect, just not quite for me. Would you know how I would use this if my folder/file name have spaces in it? I have looked around the web and seen that I should have "" and then the file/folder name in quotes, but it is not quite working for me.

~Matt
 
PMFJI
I was able to copy a file from a folder to one with spaces in it?:unsure:
Code:
MOZ_PLUGIN_PATH=C:\PROGRAM FILES\FOXIT SOFTWARE\FOXIT READER\plugins\
Code:
copy test.txt "%MOZ_PLUGIN_PATH%test.txt
 
PMFJI
I was able to copy a file from a folder to one with spaces in it?:unsure:
Code:
MOZ_PLUGIN_PATH=C:\PROGRAM FILES\FOXIT SOFTWARE\FOXIT READER\plugins\
Code:
copy test.txt "%MOZ_PLUGIN_PATH%test.txt
Cannot even explain how, but today the same code works fine. All sorted.

~Matt
 
I got it to update my links...

Code:
 Private Sub Link()
    Dim dbFE As DAO.Database
    Dim dbBE As DAO.Database
    Dim tdf As TableDef
    Dim tdf1 As TableDef
    Dim strFEFile As String
    Dim strBEFile As String
    Dim strTblName As String
    
    strBEFile = Me.txtBackEnd
    strFEFile = Me.txtFEMaster
  
    Set dbFE = DBEngine.Workspaces(0).OpenDatabase(strFEFile)
    Set dbBE = DBEngine.Workspaces(0).OpenDatabase(strBEFile)
    
    On Error Resume Next
    For Each tdf1 In dbBE.TableDefs
        strTblName = tdf1.Name
        If Left(strTblName, 4) <> "msys" Then
            dbFE.TableDefs.Delete strTblName
            Set tdf = dbFE.CreateTableDef(strTblName)
            tdf.Connect = ";DATABASE=" & strBEFile
            tdf.SourceTableName = strTblName
            dbFE.TableDefs.Append tdf
        End If
    Next tdf1
    
    Set dbBE = Nothing
    Set dbFE = Nothing
    
     MsgBox "tbl-version_fe_master was successfully linked!", vbInformation, "Link Complete"
    
End Sub
 
Im having an issue updating when I change versions though. I create my .accde and put it in my folder ect then if I change the version number on my .accdb and replace the existing .accde and open my old version it says my version is old like it should and it creates the .cmd file and updates to the new version BUT doesnt delete the .cmd file and reopen the database. If I click on the FE I was trying to update it opens and then deletes the .cmd file. I looked at the .cmd file and the paths are correct. In Bobs origional database I got rid of a lot and built off that.

Second question is for Gasman, I added a form that I wanted to make this more automated and im wanting to add a button to the form that will create a .accde from within my FE Master to make it more automated. I found a post from years ago that you asked the same question and solved it but never posted the complete code. I also attached what I have so far...

HERE is the post/thread....

Thanks,
 
The batch file update is the best way to handle this. I put a copy of the new front end on the server, link it to the back end on the server and then send everyone who will use this DB and email message to "Update Your Front End". They all have a batch file on their desktop that will update their front end by copying this new front end to their desktop and open the program. As a precaution I added a line of code to save their most recent front end to a folder on their desktop so that if something goes amiss, they will still have a copy of their old front end. This worked for more than 8 years and some of my "users" can do things to really mess up their front ends. This method has never failed me.

Listen to Pat, keep it simple!
 
Im having an issue updating when I change versions though. I create my .accde and put it in my folder ect then if I change the version number on my .accdb and replace the existing .accde and open my old version it says my version is old like it should and it creates the .cmd file and updates to the new version BUT doesnt delete the .cmd file and reopen the database. If I click on the FE I was trying to update it opens and then deletes the .cmd file. I looked at the .cmd file and the paths are correct. In Bobs origional database I got rid of a lot and built off that.

Second question is for Gasman, I added a form that I wanted to make this more automated and im wanting to add a button to the form that will create a .accde from within my FE Master to make it more automated. I found a post from years ago that you asked the same question and solved it but never posted the complete code. I also attached what I have so far...

HERE is the post/thread....

Thanks,
That is probably where your problem lies. ? :(
The most I did to Bob's code was make the check <= instead of Not =.

As for making the accde, I'll have to look on another computer.

Perhaps Pat's method is a better option for you after all?
I just have a little problem with copying something 100 or 1000 times when it is only needed once or twice, but that is just me. :D
 
OK, found the code in another DB.
I *think* you have all you need in the attached.
If not come back with specific missing items and I will go looking.

This is a DB that I probably last touched back in 2017 as far as development goes. :(

HTH
 

Attachments

No essential for creating the accde, but here is that routine.

Code:
Sub CreateBackup(Optional strDBType As String)
    Dim strDBpath As String, ext As String, tmp As String
    Dim strPath As String, strBackupPath As String, strDB As String
    
    
    'tmp = CurrentDb.Name    'or maybe this should be the name of your BE
    'strDBType = "FE"
    strDBpath = GetAccessBE_PathFilename("tblUser")
    strPath = Left(strDBpath, InStrRev(strDBpath, "\"))
    strBackupPath = strPath & "Backup\"
    
    'Will nor backup front and back end database
    If strDBType = "FE" Then
        strDBpath = CurrentDb.Name
    End If
    strDB = Right(strDBpath, Len(strDBpath) - InStrRev(strDBpath, "\"))
    
    With CreateObject("Scripting.FileSystemObject")
        'ext = "." & .GetExtensionName(tmp)
        tmp = strBackupPath & Format(Now(), "yyyymmdd_hhnnss") & "_" & strDB
        .CopyFile strDBpath, tmp
    End With
    MsgBox strDBType & " Database saved as " & tmp
    
    
End Sub
 
Ye sorry about that, i deleted my post after i realized it had nothing to do with it. I got that working and is being placed in my distribution folder... Works like a charm 👍 thanks!
 
Feel free to use it as I used to make frequent copies of both ends using it just with a click of a button. One of the few times I used macroes. :-)
 
Uploading a current version with Gasman's ACCDB to ACCDE conversion.

Capture.JPG


FEUpdatingUtility.JPG
 

Attachments

Last edited:
Gasman, I have another question about creating the .accde. When it creates the file if I open it the database window is almost the size of the form. If I open it and close then reopen its fine. This happens once to the file the employees have then its fine. Is there a reason why and can I fix that?
 
No idea, sorry. I will see if I can still use mine.
 
Christ, that was a workup as my DB was pointing to the workserver location and half the relinks did not work. :mad:

Anyway, it behaves OK with me as far as I could see?

However on that DB I used Tabbed Forms.?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom