How to get value of the object's attribute ,the object's attribute is specified by a string variable ? 
Author Message
 How to get value of the object's attribute ,the object's attribute is specified by a string variable ?

Hi:
   I want to write a common report programm,but I have a matter .I don't
know
How to get value of the object's attribute ,the object's attribute is
specified by a string variable ?
   For Example:
      '//P_Bbsjs is object,include all the Object's name and attribute's
name
      'Get all Date item
      P_Bbsjs.Fetch_Item A_Bb.Xh, P_Bbls.Rec_Bbl!Class,
P_Bbls.Rec_Bbl!Get_Lb
      While Not P_Bbsjs.Rec_Bbsj.EOF
         With P_Bbsjs.Rec_Bbsj
            'v_attr is string variable
            v_Attr =  Trim(!Class) + "." + Trim(!Item)
            '??????????????????????????????????
            'for example: v_Attr ="A_Zcd.Bh"
            'A_Zcd is object,A_Zcd.Bh is a attribute
            'How to get value of A_Zcd.Bh
            '????????????????????????????????
            .MoveNext
         End With
      Wend
   Who Can help me?

                                    Allen



Mon, 02 May 2005 11:42:00 GMT  
 How to get value of the object's attribute ,the object's attribute is specified by a string variable ?
I assume by 'attribute' you mean property. There's no simple way to do this
unless the object has been designed to facilitate it. Some objects give you
indirect access to their properties by providing a Properties collection. Eg
for a DAO recordset object you can use either:

Recordset.BOF
or
PropName = "BOF"
Recordset.Properties(PropName)


Quote:
> Hi:
>    I want to write a common report programm,but I have a matter .I don't
> know
> How to get value of the object's attribute ,the object's attribute is
> specified by a string variable ?
>    For Example:
>       '//P_Bbsjs is object,include all the Object's name and attribute's
> name
>       'Get all Date item
>       P_Bbsjs.Fetch_Item A_Bb.Xh, P_Bbls.Rec_Bbl!Class,
> P_Bbls.Rec_Bbl!Get_Lb
>       While Not P_Bbsjs.Rec_Bbsj.EOF
>          With P_Bbsjs.Rec_Bbsj
>             'v_attr is string variable
>             v_Attr =  Trim(!Class) + "." + Trim(!Item)
>             '??????????????????????????????????
>             'for example: v_Attr ="A_Zcd.Bh"
>             'A_Zcd is object,A_Zcd.Bh is a attribute
>             'How to get value of A_Zcd.Bh
>             '????????????????????????????????
>             .MoveNext
>          End With
>       Wend
>    Who Can help me?

>                                     Allen



Mon, 02 May 2005 12:20:31 GMT  
 How to get value of the object's attribute ,the object's attribute is specified by a string variable ?
Thank you.If have other method to solve this problem.


Quote:
> I assume by 'attribute' you mean property. There's no simple way to do
this
> unless the object has been designed to facilitate it. Some objects give
you
> indirect access to their properties by providing a Properties collection.
Eg
> for a DAO recordset object you can use either:

> Recordset.BOF
> or
> PropName = "BOF"
> Recordset.Properties(PropName)



> > Hi:
> >    I want to write a common report programm,but I have a matter .I don't
> > know
> > How to get value of the object's attribute ,the object's attribute is
> > specified by a string variable ?
> >    For Example:
> >       '//P_Bbsjs is object,include all the Object's name and attribute's
> > name
> >       'Get all Date item
> >       P_Bbsjs.Fetch_Item A_Bb.Xh, P_Bbls.Rec_Bbl!Class,
> > P_Bbls.Rec_Bbl!Get_Lb
> >       While Not P_Bbsjs.Rec_Bbsj.EOF
> >          With P_Bbsjs.Rec_Bbsj
> >             'v_attr is string variable
> >             v_Attr =  Trim(!Class) + "." + Trim(!Item)
> >             '??????????????????????????????????
> >             'for example: v_Attr ="A_Zcd.Bh"
> >             'A_Zcd is object,A_Zcd.Bh is a attribute
> >             'How to get value of A_Zcd.Bh
> >             '????????????????????????????????
> >             .MoveNext
> >          End With
> >       Wend
> >    Who Can help me?

> >                                     Allen



Mon, 02 May 2005 13:38:26 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to get value of the object's attribute ,the object's attribute is specified by a string variable ?

2. How to dynamic set object's attribute ?

3. Getting the type of the object associated with an attribute

4. Getting the attributes of an object

5. Null value to a user object attribute?

6. Changing attribute values of objects withing graph dynamically

7. LONG - VBScript to read AD object attributes and display their values

8. Can't identify 'Scope' or 'Headers' attributes in DOM object

9. CreateTableDef 'attributes' option

10. Can't see a database table's attributes

11. Help! I'm getting [object Object]

12. Object doesn't support this property or method : 'DTSGlobalVariables(...).Value.Open

 

 
Powered by phpBB® Forum Software