Run-time error '-2147467259 (80004005)':
Method 'SetFocus' of object 'CommandBarPopup' failed
Method 'SetFocus' of object 'CommandBarPopup' failed
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
Function AutomationTest()
On Error GoTo AutomationErr
<Automation code goes here>
AutomationExit:
Exit Function
AutomationErr:
If Err.Number = -2147467259 Then
Resume 'until control is visible.
Else
<handle any other errors>
End If
End Function
Private Sub Form_Timer()
Me.TimerInterval = 0
Application.CommandBars.ActiveMenuBar.Controls(1).SetFocus
End Sub
Menu Name: Message Menu Macro Name: Macro2 Status Bar Text: <leave blank>
Message: Hello Beep: Yes Type: None Title: <leave blank>
Option Compare Database
Option Explicit
Dim objAccess As Access.Application
Function AutomationTest()
Set objAccess = CreateObject("Access.Application")
objAccess.Visible = True
objAccess.OpenCurrentDatabase ("C:\Db1.mdb")
objAccess.DoCmd.OpenForm "Form1"
objAccess.CommandBars.ActiveMenuBar.Controls(1).SetFocus
End Function
Keywords: KB209157, kbprb