If Adodc1.Recordset.BOF True And Adodc1.Recordset.EOF True Then
MsgBox ("pas de cause probable enregistrée"), vbOKOnly
Else
rtextbCode.Text = Adodc1.Recordset!codecp
rtxtbLibelle.Text = Adodc1.Recordset!LibelleCP
End If
handler:
For Each adoer In cnn.Errors
MsgBox adoer.Description
Next
End Sub
Private Sub Form_Load()
ConnectBD 'permet de me connecter à la bd
compte
reycomenre.Enabled = False
reycommodifier.Enabled = False
reycomnouveau.Enabled = False
ReycommSupprimer.Enabled = False
rtextbCode.Enabled = False
'chargement de la liste
Adodc1.ConnectionString = cnn.ConnectionString
Adodc1.RecordSource = "select Codecp, Libellecp from causeprobable order by Codecp asc"
Set DataGrid1.DataSource = Adodc1
'fin chargement
End Sub
Private Sub reycomenre_Click()
If rtextbCode.Text = "" Then
MsgBox "ce champ code ne doit pas être vide"
rtextbCode.SetFocus
reycomenre.Enabled = False
Exit Sub
End If
If rtxtbLibelle.Text = "" Then
MsgBox "ce champ ne doit pas être vide"
rtxtbLibelle.SetFocus
reycomenre.Enabled = False
Exit Sub
End If
If Len(rtextbCode.Text) <> 4 Then
MsgBox "ce champ prend 4 caractères!!!!", vbCritical
rtextbCode.SetFocus
reycomenre.Enabled = False
Exit Sub
End If
If Len(rtxtbLibelle.Text) > 50 Then
MsgBox "ce champ doit contenir au plus 50 caractères exclusivement!!!!"
reycommodifier.Enabled = False
Exit Sub
End If
Set rsado1 = New Recordset
rsado1.Open "select * from causeprobable where codecp='" & rtextbCode.Text & "' or Libellecp = '" & DoubleQuote(rtxtbLibelle.Text) & "'", cnn, adOpenStatic, adLockOptimistic
If rsado1.RecordCount <> 0 Then
MsgBox "Vérifier code ou libellé !", vbCritical
Exit Sub
End If
rtextbCode.Text = ""
rtxtbLibelle.Text = ""
rtextbCode.Enabled = True
compte
End Sub
Private Sub reycomquitter_click()
Unload Me
End Sub
Private Sub rtxtbLibelle_Change()
reycomenre.Enabled = True
If rtxtbLibelle.Text = "" Then
reycomenre.Enabled = False
End If
If IsNumeric(rtxtbLibelle.Text) Then
MsgBox "ce champ n'est pas numérique", vbOKOnly
rtxtbLibelle.SetFocus
End If
End Sub
Private Sub compte()
Set rsado1 = New Recordset
rsado1.Open "select * from causeprobable", cnn, adOpenStatic, adLockReadOnly
With rsado1
If .RecordCount = 0 Then
rtextbCode.Text = "B.01"
Else
str1 = .RecordCount + 1
If str1 < 10 Then
str = "B.0"
rtextbCode.Text = str & str1
Else
If str1 >= 10 Then
str = "B."
rtextbCode.Text = str & str1
End If
End If
End If
End With
End Sub
superfri
Messages postés10Date d'inscriptionlundi 11 décembre 2006StatutMembreDernière intervention30 septembre 2011 26 oct. 2009 à 09:25
dans le sub enregistrer; lorsque l'enregistrement s'effectue la boite de dialogue de test de doublon dans le même sub se raffiche
dans le sub modifier la boite opération effectuée s'affiche deux fois.
c'est donc comme ci le programme s'exécute et revient afficher ces boites respectivement.
excusé de trop de code je voulais vous donnez tous les détails possibles car je me suis dit peut-être que c'est au niveau de la config ou d'une dll mais je ne sais qui ou quoi?
merci