camera point to an object when moving camera.

How can I let the camera point to an object when moving the camera along for example the x-axis.
Lock camera view is only for rotating.

Track To constraint added to the camera set to track the object

Yes I was trying that but it did not work because I had set the Up axis wrong it must be Y instead of the Z axis.
I understand now thanks.