Conditional Format Form/Subform

S

Sam Goforth

I am working with conditional formatting for the first time without success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I wish
to have the background color of a text box for _one_ of the records on the
sub change when the value of a text box (txtID) on the sub for that record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is to be
changed be set up?
 
M

Marshall Barton

Sam said:
I am working with conditional formatting for the first time without success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I wish
to have the background color of a text box for _one_ of the records on the
sub change when the value of a text box (txtID) on the sub for that record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is to be
changed be set up?


Use Field Value Is - Equal To - [Parent].[txtID]
 
S

Sam Goforth

Marshall Barton said:
Sam said:
I am working with conditional formatting for the first time without success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I wish
to have the background color of a text box for _one_ of the records on the
sub change when the value of a text box (txtID) on the sub for that record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is to be
changed be set up?


Use Field Value Is - Equal To - [Parent].[txtID]

Thanks for the input. Something is still missing. I tried the code you
suggested and nothing happened. If I type a number corresponding to the
value of txtID on the parent form in place of [Parent].[txtID] it works just
fine. I must not be referencing the txtID on the parent correctly.

Incidentally, I set the value of txtID on the parent after the form is open.
I tried DoCmd.Requery Form!frmCompare.Controls("subfrmCompare") after update
of the parent control and that does not make it work.
 
S

Sam Goforth

Your instructions worked just fine once I added one more thing. I had to
refresh the form (Me.refresh) after updating txtID on the main form.

Thanks again.

Sam


Marshall Barton said:
Sam said:
I am working with conditional formatting for the first time without success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I wish
to have the background color of a text box for _one_ of the records on the
sub change when the value of a text box (txtID) on the sub for that record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is to be
changed be set up?


Use Field Value Is - Equal To - [Parent].[txtID]
 
M

Marshall Barton

Sam said:
I am working with conditional formatting for the first time without success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I wish
to have the background color of a text box for _one_ of the records on the
sub change when the value of a text box (txtID) on the sub for that record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is to be
changed be set up?

"Marshall Barton" wrote
Use Field Value Is - Equal To - [Parent].[txtID]
Sam said:
Thanks for the input. Something is still missing. I tried the code you
suggested and nothing happened. If I type a number corresponding to the
value of txtID on the parent form in place of [Parent].[txtID] it works just
fine. I must not be referencing the txtID on the parent correctly.

Incidentally, I set the value of txtID on the parent after the form is open.
I tried DoCmd.Requery Form!frmCompare.Controls("subfrmCompare") after update
of the parent control and that does not make it work.


Try using:
Me.Recalc
in the mainform's txtID text box's AfterUpdate event.
 
S

Sam Goforth

The AfterUpdate doesn't occur since the value of txtID is set through code.
However, it all works properly if either Me.Recalc or Me.Refresh is executed
after the value of txtID is set on the parent form.

I don't find any guidance in Help as to which is preferred. I would guess
that if Recalc is issued, Refresh occurs after the calculations are
completed. Is that correct? Either happens so fast it really doesn't matter
which is faster.

In any case the problem is solved.

Thanks.

Sam



Marshall Barton said:
Sam Goforth wrote:

I am working with conditional formatting for the first time without success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I wish
to have the background color of a text box for _one_ of the records on the
sub change when the value of a text box (txtID) on the sub for that record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is
to
be
changed be set up?

"Marshall Barton" wrote
Use Field Value Is - Equal To - [Parent].[txtID]
Sam said:
Thanks for the input. Something is still missing. I tried the code you
suggested and nothing happened. If I type a number corresponding to the
value of txtID on the parent form in place of [Parent].[txtID] it works just
fine. I must not be referencing the txtID on the parent correctly.

Incidentally, I set the value of txtID on the parent after the form is open.
I tried DoCmd.Requery Form!frmCompare.Controls("subfrmCompare") after update
of the parent control and that does not make it work.


Try using:
Me.Recalc
in the mainform's txtID text box's AfterUpdate event.
 
M

Marshall Barton

Refresh goes out and looks to see if other processes and/or
users have changed any records in the form's recordset and
presumably then does a Recalc.

Recalc just updates any calculations on the form.
--
Marsh
MVP [MS Access]




Sam said:
The AfterUpdate doesn't occur since the value of txtID is set through code.
However, it all works properly if either Me.Recalc or Me.Refresh is executed
after the value of txtID is set on the parent form.

I don't find any guidance in Help as to which is preferred. I would guess
that if Recalc is issued, Refresh occurs after the calculations are
completed. Is that correct? Either happens so fast it really doesn't matter
which is faster.

In any case the problem is solved.
I am working with conditional formatting for the first time without
success.

I have a continuous subform (subfrmCompare) on a form (frmCompare). I
wish
to have the background color of a text box for _one_ of the records on
the
sub change when the value of a text box (txtID) on the sub for that
record
is equal to the value of a text box (txtID) on the form.

How should the conditional formatting for the control whose color is to
be
changed be set up?


"Marshall Barton" wrote
Use Field Value Is - Equal To - [Parent].[txtID]
Sam said:
Thanks for the input. Something is still missing. I tried the code you
suggested and nothing happened. If I type a number corresponding to the
value of txtID on the parent form in place of [Parent].[txtID] it works just
fine. I must not be referencing the txtID on the parent correctly.

Incidentally, I set the value of txtID on the parent after the form is open.
I tried DoCmd.Requery Form!frmCompare.Controls("subfrmCompare") after update
of the parent control and that does not make it work.

"Marshall Barton" wrote
Try using:
Me.Recalc
in the mainform's txtID text box's AfterUpdate event.
 

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