I have a table in which are stored control names found on a form.
I want to loop through the records in the table and "enable" the control
names found in the db table...
How can this be done?
Thanks,
Brad
dim db as database
dim rs as recordset
set db=currentdb
set rs=db.openrecordset("TableName")
rs.movefirst
do while not rs.eof
me(rs!FieldName).enabled=true
rs.movenet
loop
rs.close
set db=nothing
> I have a table in which are stored control names found on a form.
>
[quoted text clipped - 6 lines]
>
> Brad
Brad Pears - 09 Mar 2005 15:58 GMT
Thanks... One additional question...
If the conmtrols I am setting are on a subform would the syntax to set the
property be something like this...
Forms![frmPricing]![frmMenuItems].Form.RS!ItemControlName.Enabled = True
where frmPricing is the main form and frmMenuItems is the subform and
RS!ItemControlName is the DB fieldname containing the name of the control?
Thanks,
Brad
> dim db as database
> dim rs as recordset
[quoted text clipped - 18 lines]
>>
>> Brad
Brad Pears - 09 Mar 2005 16:24 GMT
Thanks... Now one additional question...
I am having problems with your syntax and maybe the fact that the controls I
am trying to set are on a subform as opposed to being on the current form...
Here is the syntax I am using...
Forms![frmPricing]![frmMenuItems].Form.RS!ItemControlName.Enabled = True
where "frmPricing" is the main form, "frmMenuItems" is the subform and
RS!ItemControlName is the DB fieldname containing the name of the control.
When I run the code I get an "Application-defined or object-defined error".
In debug, if I substitute the RS!ItemControlName with the actual field
name - it works fine. It appears that it is not obtaining the actual
controls name from RS!ItemControlName and substituting it into the command
syntax properly...
Any ideas on this one?
Thanks,
Brad
> dim db as database
> dim rs as recordset
[quoted text clipped - 18 lines]
>>
>> Brad
Rob Oldfield - 09 Mar 2005 18:38 GMT
me.SubFormControlName(rs!FieldName).enabled=true
> Thanks... Now one additional question...
>
[quoted text clipped - 42 lines]
> >>
> >> Brad