Access Subform Control

S

Scientific

Hello,

Using VBA coding, how do I change background color on a subform control.

Form name = Matrix
Subform name = sfrmAdvertise
Control name = cboProducts
 
A

Allen Browne

Try:
Forms!Matrix!sfrmAdvertise.Form!cboProducts.BackColor = vbRed

For an explanation of the .Form bit, see:
Referring to Controls on a Subform
at:
http://allenbrowne.com/casu-04.html

At first, I read your question as referring to the subform control itself,
which doesn't have a BackColor. If that's what you meant, you would need to
set the BackColor property of the sections (e.g. Detail) of the form in the
subform control.
 
S

Scientific

Allen,

Thank you very much. Your code worked perfectly and now I know an easy way
to reference controls on subforms which was a pain before. Boy do I ever
need to study more about VBA.

-Sci
 
Top