Conditional Formatting each row - Continuous Forms

G

Guest

Hello,

I have various fields that do not get the focus on a continuous form. There
is only 1 field allowed the focus: My Comments.
I want each field in the row to have a background colour when the My
Comments field has the focus.
I would like 1 row to be coloured at a time. Everything I have tried
colours every row because they are continuous forms.

Thanks in advance!
 
M

Marshall Barton

liz25mc said:
I have various fields that do not get the focus on a continuous form. There
is only 1 field allowed the focus: My Comments.
I want each field in the row to have a background colour when the My
Comments field has the focus.
I would like 1 row to be coloured at a time. Everything I have tried
colours every row because they are continuous forms.


You can not use a code procedure to color a control.
Instead, you need to use Conditional Formatting (Format
menu), which allow you to use a default color plus 3
conditional colors for a control.
 
G

Guest

Hi Marshall,
Thank you for your reply.
I do understand that I need to use conditional formatting. However, I don't
know what the Expression would be to only colour 1 field (row) at a time
based on the field My Comments having the focus and not the field that I want
to have the colour. Remember that the only field being Enabled/Unlocked is
the My Comments field all others are Locked and Disabled.
Thanks for your help.
Liz
 
M

Marshall Barton

Add a text box (named txtKey) to the form's Header section.
Then use the form's Current event to set its value to the
primary key field:
Me.txtKey = Me.yourPKfield

Now you can use the conditional formatting expression
[yourPKfield] = [txtKey]

One thing to you might want to consider as an alternative to
using CF on a bunch of separate text boxes is to add a text
box to the detail section. Make it the same size as the
detail section and use Format menu - Send to Back to put it
behind all the other controls. Then use CF on this text box
and set all(?) the other controls BackStyle to Transparent.
 
G

Guest

Hi Marshall,

Tried the two scenarios but neither seem to work. I am working in Access
2003 (sorry, I forgot to mention before). The table does not have Primary
Key. The field that is getting the focus is just a comment field. There are
duplicates in each of the other fields. More or less a staging table for
form completion.

I really appreciate your help.
Thanks.

Liz

Marshall Barton said:
Add a text box (named txtKey) to the form's Header section.
Then use the form's Current event to set its value to the
primary key field:
Me.txtKey = Me.yourPKfield

Now you can use the conditional formatting expression
[yourPKfield] = [txtKey]

One thing to you might want to consider as an alternative to
using CF on a bunch of separate text boxes is to add a text
box to the detail section. Make it the same size as the
detail section and use Format menu - Send to Back to put it
behind all the other controls. Then use CF on this text box
and set all(?) the other controls BackStyle to Transparent.
--
Marsh
MVP [MS Access]

I do understand that I need to use conditional formatting. However, I don't
know what the Expression would be to only colour 1 field (row) at a time
based on the field My Comments having the focus and not the field that I want
to have the colour. Remember that the only field being Enabled/Unlocked is
the My Comments field all others are Locked and Disabled.
 
M

Marshall Barton

I just got back from vacation and hope you didn't think your
question was abandoned.

If you do not have a primary key, then it is extremely
difficult (and in your case probably impossible) to identify
the record you want to highlight.

I do not understand what you are trying to say with "More or
less a staging table...". At this point, I can only
strongly suggest that you change the table to include a
primary key field.
--
Marsh
MVP [MS Access]

Tried the two scenarios but neither seem to work. I am working in Access
2003 (sorry, I forgot to mention before). The table does not have Primary
Key. The field that is getting the focus is just a comment field. There are
duplicates in each of the other fields. More or less a staging table for
form completion.


Marshall Barton said:
Add a text box (named txtKey) to the form's Header section.
Then use the form's Current event to set its value to the
primary key field:
Me.txtKey = Me.yourPKfield

Now you can use the conditional formatting expression
[yourPKfield] = [txtKey]

One thing to you might want to consider as an alternative to
using CF on a bunch of separate text boxes is to add a text
box to the detail section. Make it the same size as the
detail section and use Format menu - Send to Back to put it
behind all the other controls. Then use CF on this text box
and set all(?) the other controls BackStyle to Transparent.

I do understand that I need to use conditional formatting. However, I don't
know what the Expression would be to only colour 1 field (row) at a time
based on the field My Comments having the focus and not the field that I want
to have the colour. Remember that the only field being Enabled/Unlocked is
the My Comments field all others are Locked and Disabled.


liz25mc wrote:
I have various fields that do not get the focus on a continuous form. There
is only 1 field allowed the focus: My Comments.
I want each field in the row to have a background colour when the My
Comments field has the focus.
I would like 1 row to be coloured at a time. Everything I have tried
colours every row because they are continuous forms.


:
You can not use a code procedure to color a control.
Instead, you need to use Conditional Formatting (Format
menu), which allow you to use a default color plus 3
conditional colors for a control.
 

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

Similar Threads


Top