Batch File and Access

Lightwave

Ad astra
Local time
Today, 12:47
Joined
Sep 27, 2004
Messages
1,537
OK I'm using a simple batch file to copy an access front end down from a server to a local hard drive. My simple version of a front end autoupdater. :)

Code:
@Echo Off
REM copy from network drive to local drive
xcopy "\\cc-edplan-01\SPaDE\autoupdate\SPADE_FE.mde" "C:\Program Files\BlueCoyote\Test\SPADE_FE.mde" /Y /R /F
"C:\Program Files\BlueCoyote\Test\SPADE_FE.mde"
EXIT

Problem is when it calls Access07 the focus goes to the Access Database and never comes back to the DOS Window thus the EXIT command never executes.

Has anyone got any ideas on how to close the DOS window down or better still never let it open.

WinXP / Access 07
 
Last edited:
I have an autoupdater for one of my 2003 DBases,
First a Splash Screen opens, its a form, made to look like a splash, that records the username from the PC accessing the Dbase, this also allows the program to load correctly because I found if I didnt use this sometime, the query on the main screen I wanted to load on start, just didnt.

Then the mainscreen opens durring the VBA for Form_Open

it checks the user version to the one on the server, in a linked Table,
if the use is < than the Server, then it calls the update line.

The update is called from the client software,

Code:
Shell "cmd /c  c:\localdata\ED_update.bat", vbHide
docmd.close 'Close form
docmd.quit 'close Access

The vbHide Tag, Hides the dosbox, then close the form and the App, the form close is because the User is also recorded loggin out.

then while this is happening the Batch file is running

Code:
@echo off
Echo. Updating Electronic Drawings
c:
cd\
cd localdata

j:
cd\
cd common data
cd engineer'g
cd drawingloginst
cd data

copy ed.mdb c:\localdata
copy edz.mdb c:\localdata
copy ed_update.bat c:\localdata

c:
cls
Echo. Updating Drawings
echo.
echo. Update Complete
echo.
Echo. This Window can now be closed
Echo. or it will Close when you Exit the Program.
Echo.
Echo.
Echo. For Revision Details, Check on Options Tab in Program.
ED.mdb

Once the user closes the DBase after the next time, the DosBox Closes anyway,
I tried this showing the box too(hence the You can close this msg) and it still went after it was run.

the only thing I can think of that may give you problems, is your xcopy is using the Folders,
I split mine into single lines, the speed of PC's these days users dont see it.

K
 
Kai thanks for that - I have looked at Bob's autoupdater that looks like it does something similar to your program and I could do something similar but was going to do somethin quick and dirty first. I think you are probably right about the xcopy command.

I will try copy command instead

[postscript]
Nope doesn't make a difference copy or xcopy. But when I close the database focus moves back to the batch file that then executes the EXIT command and the DOS Box closes. vbhide thing looks interesting.
 
Last edited:
vbhide, is pretty kool, as you dont see the window, As I said above,

but the problem you have, is it remains open, so having the window open and hidden, could be a problem, but if its a one time event, i.e. on boot up, then it would only remain until the PC is logged off,

I honestly cant remember why my window autocloses, it might be a feature of the batch file, close after run
 
Code:
"C:\Program Files\BlueCoyote\Test\SPADE_FE.mde"
EXIT
Problem is when it calls Access07 the focus goes to the Access Database and never comes back to the DOS Window thus the EXIT command never executes.

Has anyone got any ideas on how to close the DOS window down or better still never let it open.

Here is how I am starting the FE once it is copied to the local computer:

Code:
:STARTDB
REM And run it!
START "Fandango Database" "%UserProfile%\Local Settings\Application Data\ComapnyNameHere\Fandango\Fandango_FE.accdb"
GOTO END
 
That did the trick - think the START command was the key
 
I am happy you were able to benefit as well. Thanks!
 

Users who are viewing this thread

Back
Top Bottom