Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - msaccess.exe process not terminating

Reply
 
Old 04-07-2008   #1 (permalink)


xp pro
 
 

msaccess.exe process not terminating

The below code is what i have. it first opens an access database, runs a macro and emails the saved file to multiple recipients. Everything looks like it works the way it should, but i noticed that MSACCESS.EXE process is not ending. Any suggestions as to get the process to end after this script runs? This is running on Windows Server Standard 2003.

$accessApp = new-object -com access.application
$accessApp.Application.OpenCurrentDatabase("c:\powersource\masterupdate.mdb")
$accessApp.Application.DoCmd.RunMacro("gr8eqlzero")
$accessApp.Application.CloseCurrentDatabase()

$filename = “C:\SCRIPTOUTPUT\GR8EQLZERO.CSV”
$smtpServer = “mailserverhere”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “recipient@domain.com”
$msg.To.Add(”recipient@domain.com”)
$msg.Bcc.Add("bccrecipient@domain.net")
$msg.Subject = “INVENTORY”
$msg.Body = “INVENTORY file is attached”
$msg.Attachments.Add($att)
$smtp.Send($msg)

My System SpecsSystem Spec
Old 04-07-2008   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: msaccess.exe process not terminating

Immortal_creations wrote:
Quote:

> The below code is what i have. it first opens an access database, runs
> a macro and emails the saved file to multiple recipients. Everything
> looks like it works the way it should, but i noticed that MSACCESS.EXE
> process is not ending. Any suggestions as to get the process to end
> after this script runs? This is running on Windows Server Standard
> 2003.
End with:
$accessapp.quit()

That works for me.

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 04-07-2008   #3 (permalink)


xp pro
 
 

Re: msaccess.exe process not terminating

Marco

lol I tried that. just forgot the () at the end.. geesh. still have a lot of learning to do with this stuff.
Thank you very much.
My System SpecsSystem Spec
Old 04-07-2008   #4 (permalink)


xp pro
 
 

Re: msaccess.exe process not terminating

Marco,
Does that save any updates that were done to the access database?
if not, what do i add to it?
My System SpecsSystem Spec
Old 04-07-2008   #5 (permalink)
Marco Shaw [MVP]


 
 

Re: msaccess.exe process not terminating

Immortal_creations wrote:
Quote:

> Marco,
> Does that save any updates that were done to the access database?
> if not, what do i add to it?
>
>
Searched around in the Access help and came across this:

acQuitPrompt 0
Displays a dialog box that asks whether you want to save any database
objects that have been changed but not saved.
acQuitSaveAll 1
(Default) Saves all objects without displaying a dialog box.
acQuitSaveNone 2
Quits Microsoft Access without saving any objects.

These are options you can pass to quit(). I'm not 100% sure how, but it
appears, that for Access 2007 at least, that just doing quit() will save
the database.

Marco


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Launch and Open a file in Msaccess thru cmd Microsoft Office
problems with MSACCESS 2003 Vista General
Opening an MSAccess DB .NET General
run msaccess macro from PS PowerShell
Wooly concepts? Terminating and non-terminating errors. PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46