The information in this article applies to:
SYMPTOMSWhile opening Microsoft Access and a form through Automation and setting focus to the the form custom menu bar, the following Microsoft Visual Basic error message occurs:
CAUSESetFocus fails because the control, in this case the menu bar, is not visible in the user interface at the time the Automation code executes. RESOLUTIONMicrosoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspTo work around this behavior, use either of the following methods: Method 1: Trap for the ErrorEnter a function similar to the following:
Method 2: Insert a Time DelaySet focus using code behind the form instead of the Automation code. For example, set the form TimerInterval to 1000 (the value assigned may vary). Then add the following code to the form:
MORE INFORMATION
This run-time error occurs only while using Automation. The occurrence varies based on whether or not Access is idle after the form opens, but before the Automation code attempts to set focus to a control. Variations in CPU speeds, program timing, and operating systems may cause this behavior to occur on some computers, but not others. Steps to Reproduce Behavior
REFERENCESFor more information about Automation, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "understanding Automation" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic. Additional query words: prb
Keywords : kbdta |
Last Reviewed: July 6, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |