By cmpolito ·
I need a case statement to append information into a single text field.
I have 5 Trigger (check box) fields. I want to create a case statement that will add text to the field if it is checked. I don't know if i should create a text field for this or if sql will allow me to create a temporary filed each time this report is made.

When T1 = 1 then 'trigger one is on'
When T2 = 1 then 'trigger two is on'
When T3 = 1 then ' trigger three is on'
When T4 = 1 then 'trigger four is on'
When T5 = 1 then 'trigger five is on'
End TR88,

So, if 1, 3, and 5 where checked.. then It would print out:

Trigger one is on Trigger three is on Trigger five is on

TR88 is a text box is a single text box in an Access report.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Possible Solution.

by jgarcia102066 In reply to SQL INSERT HELP

Try this:

RTRIM(CASE T1 WHEN 1 THEN 'trigger one is on ' ELSE '' END
+ CASE T2 WHEN 1 THEN 'trigger two is on ' ELSE '' END
+ CASE T3 WHEN 1 THEN 'trigger three is on ' ELSE '' END
+ CASE T4 WHEN 1 THEN 'trigger four is on ' ELSE '' END
+ CASE T5 WHEN 1 THEN 'trigger five is on' ELSE '' END)
AS TriggerText

The RTRIM() is there to remove the last space in case T5 is not checked.

Related Discussions

Related Forums