Different row colours in continuous forms

  • Thread starter Thread starter James Frater
  • Start date Start date
J

James Frater

Hello Everyone,

I have a subform with it's default view set to continuous. I'd like it so
that where the value of a check box is true it would set the backcolour of
the respective row to vbYellow.

At the moment on the on_current event of the form I've got the following code:

If Me.TBC = True Then
Me.Detail.BackColor = vbYellow
Else
Me.Detail.BackColor = vbWhite
End If

However when a check box is true it makes every row on the form yellow
rather than the individual row.

Any thoughts or pointers on what I'm doing wrong would be most appreciated.

Many thanks

JAMES
 
Hello Everyone,

I have a subform with it's default view set to continuous. I'd like it so
that where the value of a check box is true it would set the backcolour of
the respective row to vbYellow.

At the moment on the on_current event of the form I've got the following code:

If Me.TBC = True Then
Me.Detail.BackColor = vbYellow
Else
Me.Detail.BackColor = vbWhite
End If

However when a check box is true it makes every row on the form yellow
rather than the individual row.

Any thoughts or pointers on what I'm doing wrong would be most appreciated.

Many thanks

JAMES

Sorry, VBA code won't work here.

However, if your Access version is Access 2000 or newer, you can use
Conditional Formatting to do this.

Select a control on the form detail section.
Click on Format + Conditional Formatting.
Set Condition1 to
Expression Is
In the next dialog box write:
[CheckBoxName] = -1
Select the control back color.
Click OK.

Do the same for each text control in the row.
 
Fred and Bonnie,

Thank you both for you quick responses.

Fred - Using the conditional formatting works beautifully.

Thanks

JAMES

fredg said:
Hello Everyone,

I have a subform with it's default view set to continuous. I'd like it so
that where the value of a check box is true it would set the backcolour of
the respective row to vbYellow.

At the moment on the on_current event of the form I've got the following code:

If Me.TBC = True Then
Me.Detail.BackColor = vbYellow
Else
Me.Detail.BackColor = vbWhite
End If

However when a check box is true it makes every row on the form yellow
rather than the individual row.

Any thoughts or pointers on what I'm doing wrong would be most appreciated.

Many thanks

JAMES

Sorry, VBA code won't work here.

However, if your Access version is Access 2000 or newer, you can use
Conditional Formatting to do this.

Select a control on the form detail section.
Click on Format + Conditional Formatting.
Set Condition1 to
Expression Is
In the next dialog box write:
[CheckBoxName] = -1
Select the control back color.
Click OK.

Do the same for each text control in the row.
 
Back
Top