Different row colours in continuous forms

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
 
F

fredg

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

James Frater

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.
 

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