Reading a fields ControlSource from a For Loop

Soma_rich

Registered User.
Local time
Yesterday, 18:17
Joined
May 2, 2007
Messages
58
I want to create a table of all fields in a form, their datatype and their controlsource.

I have done the first 2 parts easily enough using the forms.formname.controls.name property
and
TypeName(forms.formname.controls)

But I am unable to pragmatically read the controlSource.
EG
forms.formname.controls.txtname.controlsource works
but when In a for loop
I cannot use the name of the control to return the control source.
Code:
Sub PopTab
Set frm = forms.FrmCases

for each CTl in frm.controls
MyName = ctl.name
MyType = TypeName(ctl)
MySource = ctl.name.controlsource
end if
next ctl
end sub
 
Have you tried

ctl.ControlSource
 
err no. that was a bit obvious really!
Couldnt see the wood for the trees :)
Thanks pbaldy!!!
 

Users who are viewing this thread

Back
Top Bottom