Syntaxis to loop controls (I need to update a label.control dynamically )

  • Thread starter Marcel Drost via AccessMonster.com
  • Start date
M

Marcel Drost via AccessMonster.com

Hi;

I need to update a label.control dynamically (there are about a 1000 and I have them all listed in a table...

I have this:

Dim variable As String
Set db = CurrentDb
Set mdf_query = db.OpenRecordset("MDF_query")

mdf_query.movefirst
variable = mdf_query!MFS_Hokje_id_on_form 'labelnametable/colom

if x=0 then
me![variable].backcolor = 1677752
end if


the me![variable] does not work and I need the variable (variable = controlname such as label434 from the table)I tried the with thing, that didn't help (it's me)

the last time this site was a great help, meybe it can be one more time? (help!!!)

mucho thanxs

Marcel

*****************************************
* This message was posted via http://www.accessmonster.com
*
* Report spam or abuse by clicking the following URL:
* http://www.accessmonster.com/Uwe/Abuse.aspx?aid=5dd41297a89f4db8b111b5f7c7a21cfc
*****************************************
 
G

Guest

hi,
well you have me confused.
you are using the me. indicating that you are trying to
change a form but you say that you have label names in a
table.
???
what is your query selecting?
-----Original Message-----
Hi;

I need to update a label.control dynamically (there are
about a 1000 and I have them all listed in a table...
I have this:

Dim variable As String
Set db = CurrentDb
Set mdf_query = db.OpenRecordset("MDF_query")

mdf_query.movefirst
variable = mdf_query!
MFS_Hokje_id_on_form 'labelnametable/colom
if x=0 then
me![variable].backcolor = 1677752
end if


the me![variable] does not work and I need the variable
(variable = controlname such as label434 from the table)I
tried the with thing, that didn't help (it's me)
 
M

Marcel Drost via AccessMonster.com

select the control names from a table.. I've put all control names from the report into the table.

it's a report using a control say label454

I've entered all these labelnames..
into a table selecting
the ones I want to change selcting in a query (332 records result)
So I want to change 332 times the backcolor of these controls on the report..

Hope this is more clear

regards

M

*****************************************
* A copy of the whole thread can be found at:
* http://www.accessmonster.com/Uwe/Forum.aspx/access-formscoding/19526
*
* Report spam or abuse by clicking the following URL:
* http://www.accessmonster.com/Uwe/Abuse.aspx?aid=4a852ab037bd4294a5e3d4edcde5989c
*****************************************
 
M

Marshall Barton

Marcel said:
I need to update a label.control dynamically (there are about a 1000 and I have them all listed in a table...

I have this:

Dim variable As String
Set db = CurrentDb
Set mdf_query = db.OpenRecordset("MDF_query")

mdf_query.movefirst
variable = mdf_query!MFS_Hokje_id_on_form 'labelnametable/colom

if x=0 then
me![variable].backcolor = 1677752
end if


me(variable).backcolor = 1677752
 
M

Marcel Drost via AccessMonster.com

G

Guest

hi again,
confused again.
are you trying to change the backcolor of the lable on the
report itself? Report don't have color that i am aware of.
if you are trying to change the backcolor of a lable that
is on a form, then you may be going about this the wrong
way. unless your tables is linked to all the forms and the
color is in the table, then querying the table will do
little good.
-----Original Message-----
select the control names from a table.. I've put all
control names from the report into the table.
 
Top