tags:

views:

47

answers:

1

since it seems that my conditional formatting statement is way too big:

([Panels] like '*IT_AMPH,*' or [Panels] like '*AMPH_SN,*' or [Panels] like '*AMPH_S,*') and
([Panels] like '*IT_BARB,*' or [Panels] like '*BARB_SN,*' or [Panels] like '*BARB_S,*') and
([Panels] like '*IT_BENZ,*' or [Panels] like '*BENZ_SN,*' or [Panels] like '*BENZ_S,*') and
([Panels] like '*IT_BUP,*' or [Panels] like '*BUP_SN,*' or [Panels] like '*BUP_S,*') and
([Panels] like '*IT_SOMA,*' or [Panels] like '*SOMA_SN,*' or [Panels] like '*SOMA_S,*') and
([Panels] like '*IT_FEN,*' or [Panels] like '*FEN_SN,*' or [Panels] like '*FEN_S,*') and
([Panels] like '*IT_MEP,*' or [Panels] like '*MEP_SN,*' or [Panels] like '*MEP_S,*') and
([Panels] like '*IT_METD,*' or [Panels] like '*METD_SN,*' or [Panels] like '*METD_S,*') and
([Panels] like '*MPH,*') and
([Panels] like '*IT_OPIA,*' or [Panels] like '*OPIA_SN,*' or [Panels] like '*OPIA_S,*') and
([Panels] like '*IT_OXYC,*' or [Panels] like '*OXY_SN,*' or [Panels] like '*OXY_S,*') and
([Panels] like '*IT_PROPX,*' or [Panels] like '*PROPX_SN,*' or [Panels] like '*PROPX_S,*') and
([Panels] like '*TAP,*' or [Panels] like '*TAP_SN,*' or [Panels] like '*TAP_S,*') and
([Panels] like '*IT_TRAM,*' or [Panels] like '*TRAM_SN,*' or [Panels] like '*TRAM_S,*') and
([Panels] like '*IT_TCA,*' or [Panels] like '*TCA_SN,*' or [Panels] like '*TCA_S,*') and
([Panels] like '*IT_COCN,*' or [Panels] like '*COCN_SN,*' or [Panels] like '*COCN_S,*') and
([Panels] like '*IT_6-MAM,*' or [Panels] like '*6-MAM_SN,*' or [Panels] like '*6-MAM_S,*') and
([Panels] like '*IT_MDMA,*' or [Panels] like '*MDMA_SN,*' or [Panels] like '*MDMA_S,*') and
([Panels] like '*IT_PCP,*' or [Panels] like '*PCP_SN,*' or [Panels] like '*PCP_S,*') and
([Panels] like '*IT_THC50,*' or [Panels] like '*THC_SN,*' or [Panels] like '*THC_S,*') and
([Panels] like '*ETOH_S,*' or [Panels] like '*ETOH,*') and
([Panels] like '*NIC,*') and
([Panels] like '*IT_ETG,*' or [Panels] like '*ETG_SN,*' or [Panels] like '*ETG_S,*')

i am thinking that perhaps i should do an IF statement instead of conditonal formatting. for example if the above statement is true then set the textbox font color to black

my question is will it work?

if i do an IF statement for Report_Load on the above statement, will it work as well as conditional formatting?

if so, then how would i do it? please give me some code?

+1  A: 

Consider using your complex condition in the expression for a hidden text box. You could then reference the hidden text box in a simplified conditional formatting rule.

I created txtStatus as a hidden text box, with this expression as its Control Source (foo_text is a field in the form's record source):

=IIf([foo_text] Like 'child*',1,0)

Then for the text box I display, I added a condition "Expression Is" for:

[txtStatus]>0

... and assigned red for the text attribute when the condition is True.

Maybe a similar approach can work for you.

HansUp
this is a really great idea!!! please standby while i try thank u so much
I__
this is a great idea, but can you tell me exactly where should i put the HUGE eexpression? in the CONTROL SOURCE?
I__
also in the SECOND textbox, what would the conditional formatting be? just other_text_box.text = "something" ??
I__
I was thinking about using your HUGE expression as the **condition** in an IIf() expression ... and use the IIf expression as control source. I dunno what's best here, really. Your expressions, like your SQL statements, tend to be unwieldy. Maybe it would be better to put that complex expression in a user-defined function and use the UDF as your control source.
HansUp
"what would the conditional formatting be?" Not sure. Try <code>[other_text_box] = "something"</code>
HansUp