Subform rows in VBA

G

Guest

I have a subform displaying consequtive records based on a query where I want to change background color of each subform row (or more exact selected text controls of the individual rows) depending on some properties of the records shown. When I try to do this in VBA ALL rows are affected because I cannot find a way to refer to an individual row of the subform. The VBA-routine

If StrComp(Text20, Text14, 1) <> 0 The
Text14.BackColor = RGB(255, 0, 0
Els
Text14.BackColor = RGB(255, 255, 255
End I

seems to refer to ALL rows (change color of all rows at the same time) displayed in the form
How can I refer to an individual row in this aspect ?
 
A

Allen Browne

Use conditional formatting instead of code.

Select Text14.
Choose Coditional Formatting on the Format menu.
Enter your expression, and choose your colors.

(Requires Access 2000 or later.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MethMath said:
I have a subform displaying consequtive records based on a query where I
want to change background color of each subform row (or more exact selected
text controls of the individual rows) depending on some properties of the
records shown. When I try to do this in VBA ALL rows are affected because I
cannot find a way to refer to an individual row of the subform. The
VBA-routine:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top