ACC1x: Creating Unbound Object Frame with CreateControl()ID: Q104711
|
When you use the CreateControl() function with a controltype argument of 114 to create an unbound object frame, Microsoft Access causes a general protection (GP) fault when you view the form in Form view.
The CreateControl() function does not provide any method for specifying the object to embed in the new control. Instead, an empty, unbound object frame is created. Note that you cannot create an empty, unbound object frame when you create the frame manually because Microsoft Access displays an Insert Object dialog box in which you must select the object to embed.
The GP fault occurs because Microsoft Access does not expect to run with an
empty, unbound object frame. The CreateControl() function does not provide
any method of specifying the object to embed.
The following example demonstrates how to use the sample function
CreateUnboundObjectFrame() to create an unbound object frame using a
DoMenuItem action:
NOTE: In the following sample code, an underscore (_) is used as a line-
continuation character. Remove the underscore when re-creating this code in
Access Basic.
Function CreateUnboundObjectFrame (ByVal sFormName$, _
ByVal sObjectPath$)
A_FORMDESIGNBAR = 3
A_INSERTOBJECT = 10
DoCmd SelectObject A_FORM, sFormName
SendKeys "%f" & sObjectPath & "{ENTER}"
DoCmd DoMenuItem A_FORMDESIGNBAR, A_EDIT, A_INSERTOBJECT
End Function
Microsoft has confirmed this to be a problem in Microsoft Access versions 1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.
Function CreateUnboundObjectFrame ()
Dim C As Control
Set C = CreateControl("CreateControlTest", 114)
End Function
An error has occurred in your application. If you choose Ignore, you should save your work in a new file. If you choose Close, your application will terminate.
MSACCESS caused a General Protection Fault in module MSACCESS.EXE at 0096:50B6.
Microsoft Access "The Secrets of AccessWizards," pages 12-14
Microsoft Access "Language Reference," pages 151-152 and 433-434
Additional query words: ADK GPF
Keywords : kberrmsg kbprg
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: March 26, 1999