Thanks vbaInet
That's brilliant and I'll mark this thread as solved as a result. I do have two questions however.
When I use the format wizard I can ask it to check two separate conditions so that if the field contains the word Delivery the background turns yellow and a second condition that says if the cell equals Delivery (with no other text) then the forecolor also turns yellow. This way I can have an event lasting five days. On day one it will say Delivery: Course name and on the remaining four days the box is just shaded yellow (at present boxes 2-4 say Delivery). I tried writing this:
.Add acExpression, , "[" & ctl.Name & "] Like " & Chr(34) & "*Delivery*" & Chr(34) & _
" Or " & _
"[" & ctl.Name & "] Like " & Chr(34) & "*Assessment*" & Chr(34)
.Item(0).Backcolor = vbYellow
.Add acExpression, , "[" & ctl.Name & "] = " & Chr(34) & "Delivery" & Chr(34) & _
" Or " & _
"[" & ctl.Name & "] = " & Chr(34) & "Assessment" & Chr(34)
.Item(0).ForeColor = vbYellow
.Add acExpression, , "[" & ctl.Name & "] Like " & Chr(34) & "*Design*" & Chr(34)
.Item(1).Backcolor = vbGreen
.Add acExpression, , "[" & ctl.Name & "] Like " & Chr(34) & "*Holiday*" & Chr(34)
.Item(2).Backcolor = vbRed
Without the code in bold everything works as expected. With the code in bold only delivery and assessment work and all text is in yellow. Any ideas?
Also with the code the form takes around two minutes to open. Is there any way to speed this up? I realise that it's quite a lot of formatting.
With your help I'm very close to being able to move on from this form and get on with the real work of the database.
Thanks again for all your help.
Guinness
That's brilliant and I'll mark this thread as solved as a result. I do have two questions however.
When I use the format wizard I can ask it to check two separate conditions so that if the field contains the word Delivery the background turns yellow and a second condition that says if the cell equals Delivery (with no other text) then the forecolor also turns yellow. This way I can have an event lasting five days. On day one it will say Delivery: Course name and on the remaining four days the box is just shaded yellow (at present boxes 2-4 say Delivery). I tried writing this:
.Add acExpression, , "[" & ctl.Name & "] Like " & Chr(34) & "*Delivery*" & Chr(34) & _
" Or " & _
"[" & ctl.Name & "] Like " & Chr(34) & "*Assessment*" & Chr(34)
.Item(0).Backcolor = vbYellow
.Add acExpression, , "[" & ctl.Name & "] = " & Chr(34) & "Delivery" & Chr(34) & _
" Or " & _
"[" & ctl.Name & "] = " & Chr(34) & "Assessment" & Chr(34)
.Item(0).ForeColor = vbYellow
.Add acExpression, , "[" & ctl.Name & "] Like " & Chr(34) & "*Design*" & Chr(34)
.Item(1).Backcolor = vbGreen
.Add acExpression, , "[" & ctl.Name & "] Like " & Chr(34) & "*Holiday*" & Chr(34)
.Item(2).Backcolor = vbRed
Without the code in bold everything works as expected. With the code in bold only delivery and assessment work and all text is in yellow. Any ideas?
Also with the code the form takes around two minutes to open. Is there any way to speed this up? I realise that it's quite a lot of formatting.
With your help I'm very close to being able to move on from this form and get on with the real work of the database.
Thanks again for all your help.
Guinness