Code to Shade a Field if Criteria Met

L

Linda RQ

Can I do this on my subform without using Code on an event? I am not quite
ready to do the code on my own yet.

This is my statement in english

If the ThpyTypeID_fk is equal to 88, 81,70,73,74,43 (these are my
AutoNumberIDs of the therapy types that could be entered)......Make the
backcolor to the EquipID_fk field light yelllow

The tricky part to this is both of these are combo boxes. For the
ThpyTypeID_fk, My column count is 2 and the bound column is 1 which is the
ID field in my tblTherapyType.

For the EquipID_fk field, the bound column is 3 which is the EquipID in my
Equipment Table.

This is my subform
PtThpyID
ThpyStDtTm
ThpyEndDtTm
PtID_fk
ThpyTypeID_fk
PhysID_fk
EquipID_fk
FreqID_fk
ThpyMeds_fk

Thanks,
Linda
 
J

John W. Vinson

If the ThpyTypeID_fk is equal to 88, 81,70,73,74,43 (these are my
AutoNumberIDs of the therapy types that could be entered)......Make the
backcolor to the EquipID_fk field light yelllow

Open the Form or Report in design view.

Select the control that you want colored.

Use Format... Conditional Formatting from the menu.

Use an Expression

ThpyTypeID_fk IN(88, 81,70,73,74,43)

and specify the yellow background color.

No code needed at all...

John W. Vinson [MVP]
 
L

Linda RQ

John W. Vinson said:
Open the Form or Report in design view.

Select the control that you want colored.

Use Format... Conditional Formatting from the menu.

Use an Expression

ThpyTypeID_fk IN(88, 81,70,73,74,43)

and specify the yellow background color.

No code needed at all...

John W. Vinson [MVP]

Oh my gosh! I looked in conditional formatting but didn't notice the
expression option..Not that I would have known what to type in there
but...Gee, Thanks!
Now, I looked for the IN function so I could read a little about what that
says but I can't find anything in the help file..I searced IN, IN function,
IN statement. How could I have figuered that out on my own?

Thanks,
Linda
 
R

Rick Brandt

Linda said:
Oh my gosh! I looked in conditional formatting but didn't notice the
expression option..Not that I would have known what to type in there
but...Gee, Thanks!
Now, I looked for the IN function so I could read a little about what
that says but I can't find anything in the help file..I searced IN,
IN function, IN statement. How could I have figuered that out on my
own?

It's a SQL function used in queries, not a VBA function. You'd find it in
the SQL Reference area of the help file.
 

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