Private Sub B_SupprimerProspect_Click()
'var
Dim sql As String
Dim sqlBis As String
'debut
DoCmd.SetWarnings False
If MsgBox("Vous êtes sur le point de supprimer un prospect. Etes-vous sûr?", vbYesNo) = vbNo Then
Exit Sub
Else
sql = "Delete From PROSPECT Where codeProspect=" & Me.LD_Prospect.Column(0) & ";"
DoCmd.RunSQL (sql)
sqlBis = "insert into CLIENT (raisonSociale, nomGerant, adresse, CP, ville, telephone, adresseMail, codeCategorie) values('" & Replace(Me.LD_Prospect.Column(1), "'", "`") & "','" & Replace(Me.txt_NomGerant, "'", "`") & "','" & Replace(Me.txt_Adresse, "'", "`") & "','" & Me.txt_Cp & "','" & Replace(Me.txt_Ville, "'", "`") & "','" & Me.txt_Telephone & "','" & Me.txt_Mail & "','" & Me.LD_SecteurActivité & "');"
DoCmd.RunSQL (sqlBis)
MsgBox "Le prospect a bien été supprimé et ajouté en tant que client !"
End If
Me.LD_SecteurActivité.Value = Null
Me.LD_Prospect.Value = Null
Me.txt_NomGerant = " "
Me.txt_Adresse = " "
Me.txt_Cp = " "
Me.txt_Ville = " "
Me.txt_Telephone = " "
Me.txt_Mail = " "
End Sub
Partager