subform prob

  • Thread starter Thread starter mike@work
  • Start date Start date
M

mike@work

i have the following code on the on_current event of a subform...

If Me.ID1 = Forms![Form1]![ID] Then Me.ID1.ForeColor = RGB(255, 0, 0) Else
Me.ID1.ForeColor = RGB(0, 0, 0)

the problem is this only looks at the 1st record of the subform and sets all
the records of the subform according to that criteria. obviously i want to
set each record on the subform individually.

i am self taught and struggling so any help would be greatly appreciated, ty.
 
mike@work said:
i have the following code on the on_current event of a subform...

If Me.ID1 = Forms![Form1]![ID] Then Me.ID1.ForeColor = RGB(255, 0, 0) Else
Me.ID1.ForeColor = RGB(0, 0, 0)

the problem is this only looks at the 1st record of the subform and sets all
the records of the subform according to that criteria. obviously i want to
set each record on the subform individually.


It sounds like the subform is ether displayed in either
continuous or datasheet view. In this case, you should use
Conditional Formatting (Format menu) ibstead of that code.
 
that cracked it, tyvm. problem solved in 2 mins :)

Marshall Barton said:
mike@work said:
i have the following code on the on_current event of a subform...

If Me.ID1 = Forms![Form1]![ID] Then Me.ID1.ForeColor = RGB(255, 0, 0) Else
Me.ID1.ForeColor = RGB(0, 0, 0)

the problem is this only looks at the 1st record of the subform and sets all
the records of the subform according to that criteria. obviously i want to
set each record on the subform individually.


It sounds like the subform is ether displayed in either
continuous or datasheet view. In this case, you should use
Conditional Formatting (Format menu) ibstead of that code.
 
Back
Top