bat file

hfsitumo2001

Member
Local time
Today, 03:30
Joined
Jan 17, 2021
Messages
394
I want to create a bat file on excel by creating a button and by clicking it, it will execute to copy my FE to server folder or can I make a button in the Admin form/page to copy it's FE to the server?. Can it copy itself while it is open?
 
You can use copy or xcopy in a batch file, or you can use FSO to make the FE copy itself.
 
I want to create a bat file on excel
Please clarify a little bit more which program you wish to do what.

- How is Access related to this question?
- How is Excel related to this question?

Just to make it more clear...

Regardless, in order to solve any scenario where you need a program to initiate a procedure to copy that same program that can't be open while the code runs, you can always:

1) have your host program (whether Access or Excel), create a .vbs or .bat file
2) in the .vbs or .bat file, add a 5 second pause at the beginning
3) code your host program (whether Access or Excel) to: a) create the .vbs or .bat file, b) start it running, then c) close the host program

I would recommend vbs instead of bat, it is 1000x more control-of-flow friendly.
 
Please clarify a little bit more which program you wish to do what.

- How is Access related to this question?
- How is Excel related to this question?
Actually I am the Admin and I just wanted to replace the manual job to copy updated FE from my FE folder to FE folder in server. Because I want to use Arnel's suggestion Autoupdater to copy FE from FE folder server to Client's FE.

Why I wanted to use Excel, I remember long time ago, I could create button macro and the way I created it by using "record macro" to copy my developed FE from my FE folder to Server's FE.

Hope this explains your question.

Thank you
 
to copy FE from FE folder server to Client's FE

Search AWF website for "Auto Updater"....there will be hundreds of results.

If your front end file is fairly small, and 'copies' QUICK from the network to the local (just a few seconds), then I'd recommend:

a VBScript file that always a) deletes client local folder and contents & recreates, b) copy FE from server to local, c) open FE
which assures they always get latest server version - every single time. No versioning to worry about.

here's a sanitized version of a VBS I'm using now for something:

Code:
'present a message box so that the user knows "something" is happening with this vbscript
'make sure the user has a folder in their appdata, to hold the database
'copy the latest network file into that folder
'open that file

dim strAppDataFolder, strFullPathToDatabaseFolder, fso, AccessApp

msgbox "Press OK to open the Database",vbInformation,"  "

set fso=createobject("scripting.filesystemobject")
strAppDataFolder=CreateObject("wscript.shell").specialfolders("AppData")
strFullPathToDatabaseFolder=strAppDataFolder & "\Database"

'remove whole user's local folder if it exists
if fso.folderexists(strFullPathToDatabaseFolder)=true then
    fso.deletefolder(strFullPathToDatabaseFolder)
end if

fso.createfolder strFullPathToDatabaseFolder

fso.copyfile "\\server\folder\DatabaseName.accdr",strFullPathToDatabaseFolder & "\DatabaseName.accdr"

set AccessApp = createobject("Access.Application")

dim strRun
strRun = strFullPathToDatabaseFolder & "\DatabaseName.accdr"
CreateObject("WScript.Shell").Run """" & strRun & """"
 
Oh. Yeah...it's kind of hard to decipher..
 

Users who are viewing this thread

Back
Top Bottom