Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store ActiveX OLEData?

Status
Not open for further replies.

socomfort

Technical User
Jul 8, 2005
46
US
Hello experts,

I am trying to build a control on a form in access on the fly. Here is the code segment:

Code:
Dim ctlNew As Access.Control

'********************************************
' add web browser control in details section.
'    a.) OLE Class: Microsoft Web Browser
'    b.) Class: Shell.Explorer.2
'********************************************

Set ctlNew = CreateControl(frmNew.Name, acCustomControl,  acDetail)
      
    With ctlNew

        .OLEClass = "Microsoft Web Browser"
        .Class = "Shell.Explorer.2"
        .Verb = 0
        .Visible = True

    End With

Form1 is created in my db, but the control is not built completely (correctly) as a WebBrowser control. It is not enabled and does not contain all of the properties inherent to a WebBrowser control.

When I run ?Forms(0).Controls(0).ControlType, the value retrieved is 119. This is the control type for what looks like all other (extended control types) available in Access based upon the references selected (wb controls, rich text boxes, et al).

I have messed with .OLEData and assigned an existing (manually created) WebBrowser control's properties to the new one that I create with code, but this sort of defeats the purpose of building it on the fly.

Is there another constant that I need to use to refer to the actual WebBrowser (wb) control? Is there a way to store OLEData from an existing wb control that I could assign to the dynamically created template?

thanks guys,

Ben
 
defeats the purpose of building it on the fly
So, the question is: why building it on the fly instead of playing with the Visible property ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV,

I may not be saying this right, but what I'm trying to do is build an entire form (including the controls) on the fly (using code). The form may or may not persist after this; right now I just want to see if it is possible.

I can actually build the form AND all of the commonly available controls. The constant for the "other" available controls (provided one has selected the right VBE reference) are classified as control type = 119.

So for instance, the WebBrowser control and the RichTextBox control are both acCustomControls or vbConstant = 119. When I use the following code segment:

Code:
         Set ctlNew = CreateControl(frmNew.Name, acCustomControl, acDetail)

It almost builds the WebBrowser control; the control on the form looks like a template of sorts. But I am guessing that it can't complete the creation because of that generalized control type reference. Perhaps there is a sub-control type to reference the specific acCustomControl?

But that's why I wanted to see if there was a work around for this. I did find some information on OLEData, where I could impart the actual properties from an existing WebBrowser control to the new one. But again, I am just wondering if there is a way to dynamically create all of this.

Thanks again for taking the time to reply.

regards,

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top