Click to See Complete Forum and Search --> : Object name in string
john_murphy
Nov 2nd, 1999, 05:18 PM
I have a string with my text box name in it ie
dim mystring as string
mystring = "text1"
how to I change a proprrty using only the string
ie
mystring.text = "hello"
help please
john_m_murphy@hotmail.com
------------------
Slan
baroberts
Nov 2nd, 1999, 06:11 PM
It might be done by referencing the Fields collection of the form. If you iterate through the Fields collection to find your target field by name you should have access to all of the properties of the object.
Mark Sreeves
Nov 2nd, 1999, 06:29 PM
I wanted to do something simular some time ago because i wanted to map database field names to controls
This works, but does it do waht you want
Dim mystring As Object
Dim MyObject As Control
For Each MyObject In Form1.Controls
If MyObject.Name = "Text1" Then
Set mystring = MyObject
Exit For
End If
Next
mystring.Text = "hello"
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.