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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting field names on com object form

Status
Not open for further replies.

Hfnet

IS-IT--Management
Dec 31, 2003
369
GB
Hi all,

I am doing a form as an add-in to a purchased CRM using vba in Visual Studio 2008.

I have to pull data from the currently selected item in the CRM. It is working well for most of the fields but I am having trouble getting the information from one field as I do not know what the field is called.

Is there a way to pull the field names from this third party app? I have tried the code below but I get the error indicated:

Error: Public member 'Controls' on type '_ComObject' not found.

Code:
objMaxApp = objMaxAttach.GetApplicationObject
objMaxRec = objMaxAttach.GetCurrentRecordObject

        Dim ctl As Control 
        For Each ctl In objMaxApp.Controls '>>> Error occurs here <<<
            For Each ctl0 As Control In ctl.Controls
                Debug.WriteLine(ctl0.GetType.Name)
                Debug.WriteLine(ctl0.GetType.ToString)
                'Debug.WriteLine(ctl0.ClientID)
            Next
        Next

We pull the fields with objMaxRec.GetFieldValue(" <field name> ")
 
You may try something like:
Code:
For Each fld In objMaxRec.Fields

Can't you use the Object Browser to discover all the methods/properties/events ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It doesn't show the fields on the form though.

We have one field which is displayed as Case Number. If I try to return objMaxRec.GetFieldValue("Case Number") it shows "", whereas if I try and return objMaxRec.GetFieldValue("Company") it returns the currently selected field which is labelled as Company/Individual, so the field names and labels are different, which is why I need to loop the field names to discover what they are called.

I tried your suggestion above but it produced the same error
 
It only shows me the available commands and syntax, not any fields.
 
It should also show all the Collections, doesn't it ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Can't see that anywhere. I have gone to View -> Object Browser. In pane 1 I have the components, in Pane 2 are the possible options per component and below in pane 3 is the explanation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top