when the robbery happened is a relative clause.The relative clause relates to a noun about time, afternoon.Use the relative pronoun when to introduce the relative clause.