bat file (1 Viewer)

hfsitumo2001

Member
Local time
Today, 09:00
Joined
Jan 17, 2021
Messages
365
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?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:00
Joined
Oct 29, 2018
Messages
21,468
You can use copy or xcopy in a batch file, or you can use FSO to make the FE copy itself.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:00
Joined
Feb 19, 2002
Messages
43,266
Are you saying that YOU as the developer want to automate copying updated FE's to the server? That sounds more dangerous than useful. I update FE's a lot and I don't upload the changes each time I close my development copy. So, there would need to be some way to know if you want to upload the changes this time. Also, since I always compact before uploading, this doesn't integrate well with trying to automate the upload.

You could make a batch file that is run by a shortcut but again, you would need a separate bat file and shortcut for every FE you work on. Maybe you only work on one or a small number so that isn't a problem.
 

Isaac

Lifelong Learner
Local time
Today, 09:00
Joined
Mar 14, 2017
Messages
8,777
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.
 

hfsitumo2001

Member
Local time
Today, 09:00
Joined
Jan 17, 2021
Messages
365
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
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:00
Joined
Feb 19, 2002
Messages
43,266
OK. Doing this manually, whenever you decide it is time to replace the FE with a new version -- you manually copy the FE from your PC to the server AFTER you have relinked the BE and compacted the FE.

What part of this did you want the button to do? If you want a double check, you could create an Access app or Excel, whatever floats your boat and create a form with a button. It would have to prompt for the name of the FE. Using VBA, you could check to make sure that the BE files are not linked to a local BE to ensure that you have properly relinked the BE. Of course if you want to be more specific, you could create a table of all the FE's along with the location of their BE's so you could ensure that the FE is connected to the correct BE before uploading it.

Otherwise, I can't figure out how automating this process is of any use.
 

Isaac

Lifelong Learner
Local time
Today, 09:00
Joined
Mar 14, 2017
Messages
8,777
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 & """"
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:00
Joined
Feb 19, 2002
Messages
43,266
@Isaac
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.
I think we're talking about how the developer moves an update to the server rather than how that update is distributed to the users. But, I've been wrong before.
 

Isaac

Lifelong Learner
Local time
Today, 09:00
Joined
Mar 14, 2017
Messages
8,777
Oh. Yeah...it's kind of hard to decipher..
 

Users who are viewing this thread

Top Bottom