Thanks to all those who offerred suggestions.
I appear to have had a very dirty clock signal. I've seem to have solved it by using a 555 as a monostable.
The sensing circuit outputs from a comparator which sends out a signal going high to low when the light sensor is shadowed. This low triggers the 555 monostable and the output of the monostable goes high for 2.5s before falling back to 0V. The output of the monostable is connected to the clock input of the D type latch. D is now being transferred to Q reliably and the latch is now latching nicely.
John