Results 1 to 1 of 1

Thread: How to use a variable name to access a class property. [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member swatty's Avatar
    Join Date
    Aug 2002
    Location
    somewhere on earth
    Posts
    1,478

    Lightbulb How to use a variable name to access a class property. [RESOLVED]

    I have created different classes.

    Know i want to check if a value is entered into some properties.

    I would like to make this without hardcoding the property names of the class is this possible, end if so how.

    This is how i try to use it, having the column name the same as the property of the class


    VB Code:
    1. For iCount = 0 To tbl.Fields.Count - 1
    2.       Set fld = tbl.Fields(iCount)
    3.       If fld.Properties("Required").Value = True Then
    4.          if Myclass.(fld.Name) = false then
    5.                      Debug.Print fld.Name & " - " & fld.Properties("Required").Value
    6.          End If
    7.       End If
    8.    Next




    What would you think if i sang out of tune.......

    Found it like
    VB Code:
    1. 'Replaced
    2.          if Myclass.(fld.Name) = false then
    3.  
    4.    'with
    5.          If CallByName(Myclass, fld.Name, VbGet) = False Then

    Thanks to those searching out to help.
    Last edited by swatty; Aug 14th, 2002 at 07:08 AM.
    Code:
    If Question = Incomplete Then
       AnswerNextOne
    Else
       ReplyIfKnown
    End If
    cu Swatty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width