Results 1 to 3 of 3
  1. #1
    ry94080 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2019
    Posts
    29

    VBS to check if DB is running, if not launch it

    Hi all,



    I have a Access DB setup as a display informational board. It runs just fine. However, our company pushes out office updates every few weeks which "kills" any office applications when it does it's updates.

    I was hoping to get a vbs script built that can run of the Windows Task Scheduler. That would periodically run to check to see if a particular DB was running (The display board) and if it wasn't. To launch it.

    Any ideas or code examples would be appreciated.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    I use this code to kill various tasks.
    You can perhaps adapt it.

    Code:
    ' ProcessKillLocal.vbs
    ' Sample VBScript to kill a program
    ' Author Guy Thomas http://computerperformance.co.uk/
    ' Version 2.7 - December 2010
    ' ------------------------ -------------------------------' 
    Option Explicit
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strProcessKill 
    strComputer = "."
    strProcessKill = "'msaccess.exe'" 
    
    
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _ 
    & strComputer & "\root\cimv2") 
    
    
    Set colProcess = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
    objProcess.Terminate()
    'Next 
    WSCript.Echo "Just killed process " & strProcessKill _
    & " on " & strComputer
    
    
    Next
    WScript.Quit 
    ' End of WMI Example of a Kill Process
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Amicron's Avatar
    Amicron is offline Access Guru
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Amherst, New York (near Buffalo)
    Posts
    31
    I've got this if you want a ready-made solution: Access WatchDog Template
    Richard Rost
    President/CEO
    AccessLearningZone.com

    P.S. Be sure to stop by my web site for free tutorials, tips, tricks, and lots more.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 01-26-2017, 06:38 PM
  2. Launch a form as a GUI
    By rebfein in forum Forms
    Replies: 3
    Last Post: 07-05-2016, 12:53 PM
  3. Replies: 1
    Last Post: 08-21-2014, 04:26 PM
  4. Replies: 3
    Last Post: 10-19-2012, 04:30 PM
  5. Launch URL from code
    By GraeagleBill in forum Programming
    Replies: 8
    Last Post: 08-22-2011, 12:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums