A communication apparatus configured to execute a wireless communication complying with IEEE802.11 standard, the communication apparatus comprising: process means configured to search, in response to a connection request by a user, for an access point in which an automatic setting process for setting a parameter for wireless communication is running, and to set the parameter in accordance with a method of the setting process; characterized by setting means configured to, when a connection process for connecting to the access point fails after the setting, set a value of a flag to valid or invalid based on an error content of the failure in the connection process corresponding to information on the error content registered in advance in a storage unit comprised in the communication apparatus, and select either a first process, if it is determined that the flag is set to invalid, in which the searching is performed and then the setting is performed, or a second process, if it is determined that the flag is set to valid, in which the searching is not performed and the setting is performed in accordance with the method of the setting process that is running at the access point to which the connection process failed, wherein the process means is configured to execute the process that is selected by the setting means upon receiving a re-connection request by the user. process means configured to search, in response to a connection request by a user, for an access point in which an automatic setting process for setting a parameter for wireless communication is running, and to set the parameter in accordance with a method of the setting process; characterized by setting means configured to, when a connection process for connecting to the access point fails after the setting, set a value of a flag to valid or invalid based on an error content of the failure in the connection process corresponding to information on the error content registered in advance in a storage unit comprised in the communication apparatus, and select either a first process, if it is determined that the flag is set to invalid, in which the searching is performed and then the setting is performed, or a second process, if it is determined that the flag is set to valid, in which the searching is not performed and the setting is performed in accordance with the method of the setting process that is running at the access point to which the connection process failed, set a value of a flag to valid or invalid based on an error content of the failure in the connection process corresponding to information on the error content registered in advance in a storage unit comprised in the communication apparatus, and select either a first process, if it is determined that the flag is set to invalid, in which the searching is performed and then the setting is performed, or a second process, if it is determined that the flag is set to valid, in which the searching is not performed and the setting is performed in accordance with the method of the setting process that is running at the access point to which the connection process failed, wherein the process means is configured to execute the process that is selected by the setting means upon receiving a re-connection request by the user.