You may receive a "There is no object in this control" error message when you open a form that was saved in Access 97 and that contains ActiveX controls developed with ATL (197490)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ 2005 Express Edition
- Microsoft Visual C++ .NET (2003)
- Microsoft Visual C++ .NET (2002)
- Microsoft Access 97
This article was previously published under Q197490 SYMPTOMS When opening a form that was saved in Access 97 and
that contains ActiveX controls developed with ATL, you might get a message box
stating the following: There is no object in this
control. CAUSE This error can be caused when the control does not support
the stock property for Enabled. RESOLUTION If you are developing a control using ATL and plan to use
it in Microsoft Access, be sure to support the Enabled stock property. The ATL COM Object Wizard can add the needed code
if you select Enabled from the list of available stock properties on the last property
page when inserting the full control. If you already have a control
project that does not have the Enabled stock property selected, you can add support for it using the
steps outlined here.
- Determine whether or not your control has support for ANY
stock properties. If not, modify the header file for the control to include
support for ATL's default stock property support and comment out the
IDispatchImpl derived class. For example:
class ATL_NO_VTABLE CATLAccessKBControl :
public CComObjectRootEx<CComSingleThreadModel>,
//public IDispatchImpl<IATLAccessKBControl, &IID_IATLAccessKBControl,
\ //&LIBID_ATLACCESSCONTROLLib>,
public CStockPropImpl<CATLAccessKBControl, IATLAccessKBControl, \
&IID_IATLAccessKBControl, &LIBID_ATLACCESSCONTROLLib>,
//rest of interfaces that are derived....
- Modify the IDL file by adding support for propget/propput
methods for DISPID_ENABLED. For example:
[
object,
uuid(91A905D0-8B9F-11D2-8F10-00C04F94089E),
dual,
pointer_default(unique)
]
interface IATLAccessKBControl : IDispatch
{
[propput, id(DISPID_ENABLED)] HRESULT Enabled([in]VARIANT_BOOL
vbool);
[propget, id(DISPID_ENABLED)] HRESULT Enabled([out,retval] \
VARIANT_BOOL*pbool);
};
- Add a member variable to the control's header file, which
will have the enabled stock property value. For example:
class ATL_NO_VTABLE CATLAccessKBControl :
public CComObjectRootEx<CComSingleThreadModel>,
//rest of interfaces that are derived...
{
public:
BOOL m_bEnabled;
//rest of class definition
};
Be sure to name the property "m_bEnabled" so ATL framework correctly
sets it.
STATUS
This behavior is by design.REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
177105
"There is no object in this control" error inserting Web Browser Control
Modification Type: | Major | Last Reviewed: | 1/6/2006 |
---|
Keywords: | kberrmsg kbtshoot kbAddIn kbContainer kbCtrlCreate kbprb KB197490 kbAudDeveloper |
---|
|