Question : Access - Creating new field contents from several other fields

I have a table that includes the following fields:

Session 1 (text – day of the week)
Morning (yes/no)
Afternoon (yes/no)
Session 2 (text – day of the week)
Morning (yes/no)
Afternoon (yes/no)

I have added a new field called Availability.  I want to create an update query that will once and for all add text to the Availability field with data from the above 6 fields in text form – eg:

Record 1
Thursday morning
Saturday afternoon

Record 2
Monday morning, afternoon

Record 3
Tuesday morning
Wednesday morning, afternoon


I have figured out that I can create an update query to do this but I cannot work out how to include the logic to turn the morning/afternoon ticks into text.
Neither can I see how to insert a newline character to put the new text onto multiple lines.

Note that some of the Session fields are empty.

I hope that you can help me out with this.  I am sure that just a nudge in the right direction will get me going.

Best regards

Richard

Answer : Access - Creating new field contents from several other fields

Because any time you have an operation that has a Null operand, the result is Null :)

Use Nz() to escape the Null:

UPDATE [Updating WOW] SET Availability = [Session 1 - Day]+
IIf([S1 - Morning]," Morning","")+
IIf([S1 - Afternoon]," Afternoon","")+
IIf([S1 - Evening]," Evening"," ") +
Nz([S1 - Details], "");
Random Solutions  
 
programming4us programming4us