Update Front End

As you saw from my screenshot, I also often copy an entire folder.
I store standard images like logos together with help files etc in a Common folder on the network
The additional files saved locally include 3 legacy DLLs for the occasional client still on very old versions, a version text file which is used for comparison before any files are downloaded. The subfolders contain template files for exporting items to Access or Excel files e.g. student/class reports.

Even so the major part of the download is the FE itself - over 110 MB but it used to be 130 MB at one time.
And no it doesn't contain any attachment fields - its just a huge FE database ... the SQL BE is currently around 2.2 GB
 
An API is still the best option , as long as the API is trusted and well documented.
 
An API is still the best option , as long as the API is trusted and well documented.
The "I" in "API" stands for "interface". An API isn't a program, it's an interface to a program or a computer. To what program are you suggesting an API is the best interface?
 
The link in post #56 relates to OneDrive.
It isn't what is needed for copying files on the same computer (or local network).
This is the code I use. It should work in both 32-bit & 64-bit
Copy into a standard module e.g. modCopyAPI

Rich (BB code):
Option Compare Database
Option Explicit

'API declarations - updated 12/03/2019

Private Type SHFILEOPSTRUCT
    #If VBA7 Then
        hWnd As LongPtr
    #Else
        hWnd As Long
    #End If
    wFunc As Long
    pFrom As String
    pTo As String
    fFlags As Integer
    fAnyOperationsAborted As Long
    
    #If VBA7 Then
        hNameMappings As LongPtr
    #Else
        hNameMappings As Long
    #End If
    
    lpszProgressTitle As String
End Type

'#####################################

#If VBA7 Then 'A2010 or later (32/64-bit)
    Private Declare PtrSafe Function SHFileOperation Lib "shell32.dll" _
    Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

#Else 'A2007 or earlier
    Private Declare Function SHFileOperation Lib "shell32.dll" _
    Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

#End If
'#####################################

Private Const FOF_ALLOWUNDO = &H40
Private Const FOF_NOCONFIRMATION = &H10
Private Const FO_COPY = &H2

'#####################################

Public Function apiFileCopy(src As String, Dest As String, _
    Optional NoConfirm As Boolean = False) As Boolean
    
     'PARAMETERS: src: Source File (FullPath)
     'dest: Destination File (FullPath or directory)
     'NoConfirm (Optional): If set to true, no confirmation box
     'is displayed when overwriting existing files, and no
     'copy progress dialog box is displayed
    
     'Returns (True if Successful, false otherwise)
    
    Dim WinType_SFO As SHFILEOPSTRUCT
    Dim lRet As Long
    Dim lflags As Long
    
    lflags = FOF_ALLOWUNDO
    If NoConfirm Then lflags = lflags & FOF_NOCONFIRMATION
    
    With WinType_SFO
        .wFunc = FO_COPY
        .pFrom = src
        .pTo = Dest
        .fFlags = lflags
    End With
    
    lRet = SHFileOperation(WinType_SFO)
    apiFileCopy = (lRet = 0)
    
End Function

To run the code, use something like this:

Rich (BB code):
Sub TestCopy()

    Dim FromPath As String, ToPath As String
    
    'select a file or folder
   ' FromPath = "G:\Programs\MendipDataSystems\CommonFiles\UKPAF\Datafiles\Postcodes.accdb" 'source file to be copied
    FromPath = "G:\Programs\MendipDataSystems\CommonFiles\UKPAF\Datafiles\" 'source folder to be copied
    
    ToPath = "G:\MyFiles\ExampleDatabases\APIFileCopy\" 'destination folder
    
    Call apiFileCopy(FromPath, ToPath, True) 'set false to prevent the progress dialog being displayed - slightly faster
    
   ' MsgBox "Done"
    
End Sub

Example dialog (showing more details as option):
1640339220208.png
 

Attachments

OK, thanks.

I"m glad to hear that using the Windows copy command is using "an API", if that's a better way of doing things.
 
You are correct @isladogs


is one of several that can be used for file system API
I'm sorry but that link isn't relevant either. As it clearly states in the article, its allows Web apps to interact with local files which is nothing to do with the point of this thread
 
I'm sorry but that link isn't relevant either. As it clearly states in the article, its allows Web apps to interact with local files which is nothing to do with the point of this thread
its a web based api that allows the manipulation of files and folders in the users local computer system.

So its left to the strenght of the user, apis' to achieve it can be created in languages like

c#, c++ etc.
 
its a web based api that allows the manipulation of files and folders in the users local computer system.

Yes I know what it is - I read the article as well before replying.
As already stated, its not relevant to copying files from a network location to update files on a local drive.

But if you can provide actual code that would do exactly that based on the link provided, do enlighten me.
 
Can I bring up a related issue I've been having with this - the batch file is created to update FE but not run automatically.
I believe it is related to an anti-virus software running on the machine (typically Avast). Would anyone know how to make an exception to allow batch files to run or direct me to some more info regarding this please.
 
Can I bring up a related issue I've been having with this - the batch file is created to update FE but not run automatically.
I believe it is related to an anti-virus software running on the machine (typically Avast). Would anyone know how to make an exception to allow batch files to run or direct me to some more info regarding this please.
Hi. Just thinking out loud here, but just as Access implemented Trusted Settings to allow certain database files to run, perhaps the antivirus software has something similar. Try going into its Options or Settings screen and see if you can find s feature to allow batch files to run.
 

Users who are viewing this thread

Back
Top Bottom