slt a tous
voila je travaille sur un projet de Gestion de vidéotheque mais le probleme c'est que j'ai prevu une (frmCommande) danslaquelle l'utilisateur doit donner la (reférence Clt) dans (lblnum.text) et appuyer sur le boutton VALIDER N°CLT
normalement j'ai ajouter dans ma frmCommande une Adodc1 connecté a ma table Clients j'arrive mnt a récupérer la ref client et a l'afficher mais maintenant lorsque j'ai ajouté le cas danslequel il se peut que la refclient saisie par l'utilisateur n'est pas valide alors (maintenant meme si j'entre une refclt valide le message(MsgBox("Le client " & lblnum.Text & " n'existe pas. Voulez vous enregistrer un nouveau client ?", vbYesNo + vbInformation, "Attention...")
aidez moi et merci d'avance
Private Sub cmdCltValider_Click()
Dim Rep As String
Dim marequete As String
If lblnum.Text = "" Then
Rep = MsgBox("Veuillez rentrer le numero du client.", vbInformation, "Attention...")
Exit Sub
End If
marequete = "SELECT * FROM Clients WHERE Refclient LIKE '" & lblnum.Text & "'"
If Not Adodc1.Recordset.EOF Then
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = marequete
Adodc1.Refresh
lblnom.Caption = Adodc1.Recordset![Nom]
lblprenom.Caption = Adodc1.Recordset![Prenom]
lbladresse.Caption = Adodc1.Recordset![Adresse]
lbltel.Caption = Adodc1.Recordset![Téléphone]
Else:
Rep = MsgBox("Le client " & lblnum.Text & " n'existe pas. Voulez vous enregistrer un nouveau client ?", vbYesNo + vbInformation, "Attention...")
If Rep = vbYes Then
frmCommande.Hide
frmClient.Show
Exit Sub
End If
End If