Article ID: 167659
Article Last Modified on 1/19/2007
Option Explicit
Private Declare Function ShowWindow Lib "User32" _
(ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Sub StartAccessHidden()
Dim sw As Long
Dim appAccess As Object
On Error Resume Next
' Start an instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Hide the instance of Microsoft Access.
sw = ShowWindow(appAccess.hWndAccessApp, False)
If Err.Number = 0 Then
MsgBox "The instance of Microsoft Access was started " & _
"and hidden successfully. Click OK to view the " & _
"instance."
' Unhide the instance of Microsoft Access.
appAccess.Visible = True
appAccess.UserControl = True
Else
Err.Clear
MsgBox "The instance of Microsoft Access was not " & _
"started successfully."
End If
End Sub
StartAccessHiddenNote that an instance of Microsoft Access is started and is immediately hidden. After you click OK in the message box, the instance of Microsoft Access becomes visible. To close the second instance of Microsoft Access, click Exit on the Microsoft Access File menu.
Option Explicit
Sub StartAccess()
Dim appAccess As Object
' Start an instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
End Sub
StartAccessNote that an instance of Microsoft Access starts and is fully visible. To close the instance of Microsoft Access, click Exit on the Microsoft Access File menu.
147816 ACC: Using Microsoft Access as an Automation Server
Additional query words: OLE pra
Keywords: kbbug kbfix kbinterop kbprogramming KB167659