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:
For iCount = 0 To tbl.Fields.Count - 1
Set fld = tbl.Fields(iCount)
If fld.Properties("Required").Value = True Then
if Myclass.(fld.Name) = false then
Debug.Print fld.Name & " - " & fld.Properties("Required").Value
End If
End If
Next
What would you think if i sang out of tune.......
Found it like
VB Code:
'Replaced
if Myclass.(fld.Name) = false then
'with
If CallByName(Myclass, fld.Name, VbGet) = False Then
Thanks to those searching out to help.