Results 1 to 4 of 4

Thread: how to close Access aplication if is opened

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,955

    how to close Access aplication if is opened

    How to close Access aplication if is opened?

  2. #2
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,717

    Re: how to close Access aplication if is opened

    The first thing that I would try is clicking in the X in the right top of the window.

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,917

    Re: how to close Access aplication if is opened

    If that doesn't work, right-click your taskbar, select task manager, select Access, right-click it, and say 'End Task'.

    Now, if you want to do it from VB6, there are several posts that have discussed how to kill a task, some that I have posted. But I'll let you search for those. Do you need instructions on how to search?
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  4. #4
    Lively Member
    Join Date
    Jan 2025
    Posts
    72

    Re: how to close Access aplication if is opened

    Solution 1 shows how to close the application:
    Code:
    Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
    Declare Function PostMessageA Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, _
                        ByVal wParam As Long, _
                        ByVal lParam As Long) As Long
    
     
    
    Sub CloseAccess()
     
        Const WM_CLOSE = 16
        Dim hWnd As Long
        hWnd = FindWindowA("OMAIN", 0)
        If hWnd <> 0 Then
           PostMessageA hWnd, WM_CLOSE, 0, 0
        End If
    End Sub
    To terminate the processus;
    Code:
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Process")
    For Each objItem In colItems
        If StrComp(objItem.Name, "MsAccess.exe", vbTextCompare) = 0 Then
          objItem.Terminate
      End If
      
    Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width