The present invention provides a compoundrepresented by the formula (I):(see formula I)wherein each symbol is as defined in the description, or asalt thereof. The compound or a salt thereof or a prodrugthereof has a GPR40 receptor function modulating action andmight therefore be useful as an insulin secretagogue or mighttherefore be useful as an agent for the prophylaxis ortreatment of diabetes and the like.