subform prob

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.
 
M

Marshall Barton

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.
 
M

mike@work

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.
 

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