Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch file copies and launches mde sometimes 2

Status
Not open for further replies.

tballky

Programmer
Jun 10, 1999
11
0
0
US
have provided a user's desktop icon of the following batch file. it should copy a newest version of mde application from mapped G server drive to users pc and launch. it usually works fine but sometimes launches the existing mde instead of the new one. if this batch file is run several times, the correct program is finally copied and launched. OS are both Win2000 and XP Pro using a Novel network.

is there a way to force the copy over the existing mde to complete before the lauch? if it can not be copied, it should fail, not launch. delete first and then copy perhaps?

also, if the users mde is open, can this close it before the copy since two sessions result? if there is something else that could explain the older version being used, using this batch file, your thoughts will be welcome.

finally, is there a way to close the batch file when completed? now it stays in tray until Access is exited.


@Echo Off
CLS
Echo -=-=-=-=-=-= Tom Ball Software Updater =-=-=-=-=-

if not exist c:\refunds md c:\refunds
copy g:\"tax dept"\refunds\Real_Refunds.mde c:\refunds\Real_Refunds.mde /y
Echo Running Latest Version
rem pause

echo Launching Application ....
c:\refunds\Real_Refunds.mde
 
START then the path to msaccess.exe then the path to the mde will launch the mde and close the batch file.

how about this:

@Echo Off
CLS
Echo -=-=-=-=-=-= Tom Ball Software Updater =-=-=-=-=-

if exist "c:\refunds\Real_Refunds.mde" del "c:\refunds\Real_Refunds.mde"

if not exist c:\refunds md c:\refunds
copy g:\"tax dept"\refunds\Real_Refunds.mde c:\refunds\Real_Refunds.mde /y
Echo Running Latest Version
rem pause

echo Launching Application ....
START "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "c:\refunds\Real_Refunds.mde
 
How about adding at the beginning of your existing process:

[tt]
:LDBCHECK
if not exist "C:\refunds\Real_Refunds.LDB" GOTO COPYFILE
echo ERROR: Close the database, then press ENTER to continue.
pause
GOTO LDBCHECK

:COPYFILE[/tt]


Whenever they have the file open, a .LDB file is created, so you can (pretty much) guarantee that this will work. If you want a more foolproof system, use a richer environment to run checks (like a MDB file that runs this code, or a VBScript .VBS file...)

But I think the above will work.
 
didn't think the user would have the application open and try to open again. you are right, closing the database before the copy would be needed. i was trying to keep it simple and telling them what to do is good. any ideas on closing the batch file? thanks!

I thought i tried to try that...
 
this should launch the database and then close the batch file.

START "C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "c:\refunds\Real_Refunds.mde
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top