Subform rows in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
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 ?
 
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:
 
Back
Top