Kill MSAccess process via batchfile

March 30, 2009 at 03:11:26
Specs: Windows XP
Hi

I have written a macro that executes a query in MSAccess database. I have also created a batch file and contains the follwing code to execute every one hour.

START
"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE" "d:\Card_2000.MDB" /x IODataMacro
TASKKILL /F /fi /IM MSACCESS.EXE /T
echo Process is finished succesfully at %TIME%, %DATE% >> d:Testlog.txt
GOTO END
:END

But the task kill command is not getting executed one the macro is done. Can anyone assist me getting this resolved.

Thanks in Advance

isihalin


See More: Kill MSAccess process via batchfile

Report •


#1
March 30, 2009 at 03:51:43
i hope taskkill don't corrupt your database.

the correct systanx should be:
taskkill /f /im msaccess.exe
taskkill /f /fi "imagename eq msaccess.exe"

instead of the above, i suggest using vbs to gracefully close the database:
with createobject("access.application")
.opencurrentdatabase("d:\Card_2000.MDB")
.docmd.runmacro("IODataMacro")
'.closecurrentdatabase
'.quit
end with

(!!untested)

or on the last line of IODataMacro, add the following line:
Application.quit


Report •

#2
March 30, 2009 at 06:09:02
Hi
Thanks, it works, but how do i track the completion. I need to write a log once the task is completed.

Thanks in advance
Diwakar


Report •

#3
March 30, 2009 at 07:11:41
which one do you use?

Report •

Related Solutions

#4
March 30, 2009 at 08:10:25
Hi

If you see my first code. i would have written a log for the macro completion. i would require the same in vbs.

echo Process is finished succesfully at %TIME%, %DATE% >> d:Testlog.txt

Thanks in advance,
isihalin


Report •

#5
March 30, 2009 at 09:01:53
f="c:\test.log"
with createobject("scripting.filesystemobject").opentextfile(f,8,true)
	.writeline time & ", " & date
	.close
end with


Report •

#6
March 30, 2009 at 09:06:39
Hi

Thanks a lot.


Report •


Ask Question