Demande d'aide

cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017 - 27 déc. 2006 à 10:46
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017 - 28 déc. 2006 à 10:47
Slt à tous je fais un programme et j'ai des erreurs que j'arrive pas à corriger. Je sais pas si je peux poster tous le code avec le formulaire pour qu'on le corrige pour moi. Merci de m'aider.

11 réponses

lilo44 Messages postés 174 Date d'inscription vendredi 25 janvier 2002 Statut Membre Dernière intervention 15 février 2007 2
27 déc. 2006 à 10:52
Bonjour,

De toute facon, sans code, personne ne pourra vous aider ....

madame soleil peut etre ? :)
0
jmfmarques Messages postés 7666 Date d'inscription samedi 5 novembre 2005 Statut Membre Dernière intervention 22 août 2014 27
27 déc. 2006 à 11:20
Ce que dis lilo44 + en commentant ton code et en disant la nature exacte de la ou des erreur(s) concernées...
0
lilo44 Messages postés 174 Date d'inscription vendredi 25 janvier 2002 Statut Membre Dernière intervention 15 février 2007 2
27 déc. 2006 à 11:25
rhooo . c'etait en francais ma phrase ^^
0
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017
27 déc. 2006 à 11:26
Il est entièrement fait en utilisant la source de donnée ADO. Je sais pas si on peut le convertir en utilisant autres source plus fiable. Merci

'***********************************************************************
' Ce petit programme est fait pour gerer les affections des agents *
' vers un site. Mais ca genère quelques erreurs que je ne comprend pas.
' Le problème se situe au niveau de la sauvegarde.
'***********************************************************************
'Déclaration des variables utilisées
Dim ok As Long
Dim rea As Integer

Private Sub cltm_Click()

If cltm.Value = True Then
cltp.Value = False
cmbpren.Enabled = False
cmbrscm.Enabled = True
End If
End Sub

Private Sub cltp_Click()

If cltp.Value = True Then
cltm.Value = False
cmbpren.Enabled = True
cmbrscm.Enabled = False
End If
End Sub

Private Sub cmbaagt_Change()

Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("nom_pren_agt='" & cmbaagt.Text & "'")

txtcagt.Text = Adoagt.Recordset![noagt]

Call reche_agt_aff

End Sub
Private Sub reche_agt_aff()

Adoagaf.CommandType = adCmdTable
Adoagaf.RecordSource = "agent_aff"
Adoagaf.Refresh

If Adoagaf.Recordset.RecordCount > 0 Then
Adoagaf.Recordset.MoveFirst
Adoagaf.Recordset.Find ("noagt= '" & txtcagt.Text & "'")
If Adoagaf.Recordset.EOF = False Then
If MsgBox(" CET AGENT A ETE DEJA AFFECTE A UN SITE,VOULEZ VOUS LE REAFFECTER", vbYesNo + vbQuestion, "ALERTE") = vbYes Then
Adoagaf.Recordset.Delete
Call affiche_agt
End If
Else
Call affiche_agt
End If
Else
Call affiche_agt
End If

End Sub
'Code d'affichage d'agent sélectionné
Private Sub affiche_agt()
Adolignaff.CommandType = adCmdTable
Adolignaff.RecordSource = "ligne_affectation"
Adolignaff.Refresh

Adolignaff.Recordset.MoveFirst 'ajouter dernièrement
Do While Adolignaff.Recordset![Numero] <> rea
Adolignaff.Recordset.MoveNext
Loop

Adolignaff.Recordset.Fields(1).Value = txtcagt.Text
Adolignaff.Recordset.Fields(2).Value = cmbaagt.Text


grilleaffect.AllowUpdate = True
grilleaffect.Columns(0).Locked = True
grilleaffect.Columns(1).Locked = True
grilleaffect.Columns(2).Locked = True
grilleaffect.Columns(3).Locked = False

End Sub
Private Sub cmbnomagt_Change()

Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("nom_pren_agt='" & cmbnomagt.Text & "'")

txtcagt.Text = Adoagt.Recordset![noagt]

Call rech_agt_aff


End Sub
'Code recherchent l'existance d'un agent pour une affectation
Private Sub rech_agt_aff()

Adoagaf.CommandType = adCmdTable
Adoagaf.RecordSource = "agent_aff"
Adoagaf.Refresh

If Adoagaf.Recordset.RecordCount > 0 Then
Adoagaf.Recordset.MoveFirst
Adoagaf.Recordset.Find ("noagt= '" & txtcagt.Text & "'")
If Adoagaf.Recordset.EOF = False Then
If MsgBox(" CET AGENT A ETE DEJA AFFECTE A UN SITE,VOULEZ VOUS LE REAFFECTER", vbYesNo + vbQuestion, "ALERTE") = vbYes Then

'supprimer le nbre d'agent ds l'affectation concerné

nf = Adoagaf.Recordset![noaff]
Adoaff.Recordset.MoveFirst
Adoaff.Recordset.Find ("noaff= '" & nf & "'")
Adoaff.Recordset![nbre_agt] = Adoaff.Recordset![nbre_agt] - 1
Adoaff.Recordset.Update
'supprimer l'enregistrement concernant l'agent ds la table agent_affectation

Adoagaf.Recordset.Delete
Call affich_agt
End If
Else
Call affich_agt
End If
Else
Call affich_agt
End If

End Sub
'Code d'affichage d'agent sélectionné
Private Sub affich_agt()
Adolignaff.CommandType = adCmdTable
Adolignaff.RecordSource = "ligne_affectation"
Adolignaff.Refresh

Adolignaff.Recordset.MoveFirst 'ajouter dernièrement
Do While Adolignaff.Recordset![noagt] <> ""
Adolignaff.Recordset.MoveNext
Loop
Adolignaff.Recordset.Fields(1).Value = txtcagt.Text
Adolignaff.Recordset.Fields(2).Value = cmbnomagt.Text

grilleaffect.AllowUpdate = True
grilleaffect.Columns(0).Locked = True
grilleaffect.Columns(1).Locked = True
grilleaffect.Columns(2).Locked = True
grilleaffect.Columns(3).Locked = False

End Sub
'Code lié au champ nom et prenom
Private Sub cmbpren_change()
' cmbrscm.Enabled = False
If cmbpren.Text <> "" Then
Adocltp.Recordset.MoveFirst
Adocltp.Recordset.Find ("nom_pren_cltp = '" & cmbpren.Text & "'")
If Adocltp.Recordset.EOF = False Then
txtcode.Text = Adocltp.Recordset![nocltp]

End If


End If
End Sub


'Code lié au champ raison social
Private Sub cmbrscm_Change()


If cmbrscm.Text <> "" Then
Adocltm.Recordset.MoveFirst
Adocltm.Recordset.Find ("rscm = '" & cmbrscm.Text & "'")

If Adocltm.Recordset.EOF = False Then

txtcode.Text = Adocltm.Recordset![nocltm]

End If
End If
End Sub



Private Sub cmdajout_Click()

Call initialiser

nbaff = txtnbagt.Text

naf = Adoaff.Recordset.RecordCount

If naf > 0 And Val(txtnbagt) <> 0 Then
Adoagaf.Refresh
Adoagaf.Recordset.MoveFirst


Do While Adoagaf.Recordset.EOF = False

If Adoagaf.Recordset![noaff] = txtnum.Text Then

noag = Adoagaf.Recordset![noagt]
Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt='" & noag & "'")


Adolignaff.Recordset.AddNew

Adolignaff.Recordset.Fields(0) = Adoagaf.Recordset![Numero]
Adolignaff.Recordset.Fields(1) = Adoagaf.Recordset![noagt]
Adolignaff.Recordset.Fields(2) = Adoagt.Recordset![nom_pren_agt]
Adolignaff.Recordset.Fields(3) = Adoagaf.Recordset![duree_aff]

Adolignaff.Recordset.Save


End If

If Adoagaf.Recordset.EOF = False Then
Adoagaf.Recordset.MoveNext
End If

Loop
End If

nagt = InputBox("Nombre d'agents à affecter :", "NOMBRE D'AGENTS")

txtnbagt.Text = Val(nagt) + Val(nbaff)

Adolignaff.CommandType = adCmdTable
Adolignaff.RecordSource = "ligne_affectation"
Adolignaff.Refresh



For i = 1 To Val(nagt)

nbaff = nbaff + 1
Adolignaff.Recordset.AddNew
Adolignaff.Recordset.Fields(0) = nbaff
Adolignaff.Recordset.Save

Next i

Call active
Call debloc
End Sub

'Code associé au bouton annuler
Private Sub cmdannuler_Click()

If MsgBox(" ANNULER L'OPERATION EN COURS ", vbYesNo + vbQuestion, "ANNULER") = vbYes Then

Adoaff.Recordset.CancelUpdate

Adoagaf.CommandType = adCmdTable
Adoagaf.RecordSource = "agent_aff"
Adoagaf.Refresh

na = Adoagaf.Recordset.RecordCount
If na > 0 Then
Adoagaf.Recordset.CancelUpdate
End If
Call bloc
Call desactive
End If

End Sub
'Procédure permettant de bloquer les boutons
Private Sub bloc()
cmdpremier.Enabled = True
cmdprecedent.Enabled = True
cmdsuiv.Enabled = True
cmdernier.Enabled = True

cmdajout.Enabled = True
cmdnouv.Enabled = True
' cmdmodif.Enabled = True
cmdannuler.Enabled = False
cmdquit.Enabled = True
cmdsupp.Enabled = True
cmdsauv.Enabled = False
End Sub
'Procédure pour desactiver les champs de saisie
Private Sub desactive()

txtdateaff.Enabled = False
txtnbagt.Enabled = False
cmbnomagt.Enabled = False
txtct.Enabled = False
grilleaffect.AllowUpdate = False
End Sub

Private Sub cmdcons_Click()
Formlistecontrat.Show
End Sub

Private Sub cmdernier_Click()
If Adoaff.Recordset.RecordCount > 0 Then
Adoaff.Recordset.MoveLast
Call actualiser
End If
End Sub



Private Sub cmdmodif_Click()

cmbaagt.Visible = True

Call initialiser

naf = Adoaff.Recordset.RecordCount

If naf > 0 Then
Adoagaf.Refresh
Adoagaf.Recordset.MoveFirst


Do While Adoagaf.Recordset.EOF = False

If Adoagaf.Recordset![noaff] = txtnum.Text Then

noag = Adoagaf.Recordset![noagt]
Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt='" & noag & "'")


Adolignaff.Recordset.AddNew

Adolignaff.Recordset.Fields(0) = Adoagaf.Recordset![Numero]
Adolignaff.Recordset.Fields(1) = Adoagaf.Recordset![noagt]
Adolignaff.Recordset.Fields(2) = Adoagt.Recordset![nom_pren_agt]
Adolignaff.Recordset.Fields(3) = Adoagaf.Recordset![duree_aff]

Adolignaff.Recordset.Save

End If

If Adoagaf.Recordset.EOF = False Then
Adoagaf.Recordset.MoveNext
End If

Loop
End If

rep = InputBox("NUMERO DE L'AGENT A REMPLACER:", "NUMERO")
rea = Val(rep)
'Adolignaff.Refresh
Call debloc
grilleaffect.AllowUpdate = True
cmbnomagt.Enabled = False

End Sub


'Code du bouton NOUVELLE(S)
Private Sub cmdnouv_Click()

Call debloc
Call active
Call initialiser



nbenr = Adoaff.Recordset.RecordCount

If nbenr > 0 Then
Adoaff.Recordset.MoveLast
If nbenr < 10 Then
ok = Right(Adoaff.Recordset![noaff], 1)
Else
If nbenr >= 10 And nbenr < 100 Then
ok = Right(Adoaff.Recordset![noaff], 2)
Else
If nbenr >= 100 And nbenr < 1000 Then
ok = Right(Adoaff.Recordset![noaff], 2)
Else
If nbenr >= 1000 And nbenr < 10000 Then
ok = Right(Adoaff.Recordset![noaff], 4)
Else
If nbenr >= 10000 Then
ok = Right(Adoaff.Recordset![noaff], 5)
End If
End If
End If
End If
End If
End If
Adoaff.Recordset.AddNew
txtdateaff.Text = Date


txtnbagt.Text = InputBox("Nombre d'agents à affecter :", "NOMBRE D'AGENTS")

Call cle_cree


Adolignaff.CommandType = adCmdTable
Adolignaff.RecordSource = "ligne_affectation"
Adolignaff.Refresh



For i = 1 To Val(txtnbagt.Text)

Adolignaff.Recordset.AddNew
Adolignaff.Recordset.Fields(0) = i
Adolignaff.Recordset.Save

Next i




grilleaffect.AllowUpdate = False
End Sub
'Code permettant de créer la clé
Private Sub cle_cree()



nb = Val(ok) + 1 'Adoaff.Recordset.RecordCount

txtnum.Text = "AFF_" & Str(Day(Date)) & "_" & Str(nb)
End Sub
'Procédure permmettant d'activer les champs de saisie
Private Sub active()

grilleaffect.AllowUpdate = False


txtct.Enabled = True
txtdateaff.Enabled = True

cmbnomagt.Enabled = True
End Sub
'Procédure permettant de débloquer les boutons
Private Sub debloc()

cmdpremier.Enabled = False
cmdprecedent.Enabled = False
cmdsuiv.Enabled = False
cmdernier.Enabled = False

cmdajout.Enabled = False
cmdmodif.Enabled = False
cmdnouv.Enabled = False
' cmdmodif.Enabled = False
cmdannuler.Enabled = True
cmdquit.Enabled = False
cmdsupp.Enabled = False
cmdsauv.Enabled = True

End Sub
'Code permettant d'initialiser la grille
Private Sub initialiser()

Adolignaff.CommandType = adCmdTable
Adolignaff.RecordSource = "ligne_affectation"
Adolignaff.Refresh
nla = Adolignaff.Recordset.RecordCount
If nla > 0 Then
Adolignaff.Recordset.MoveFirst
Do While nla > 0 And Adolignaff.Recordset.EOF = False
Adolignaff.Recordset.Delete
Adolignaff.Recordset.MoveNext
nla = Adolignaff.Recordset.RecordCount
Loop
End If
End Sub

Private Sub cmdprecedent_Click()
If Adoaff.Recordset.RecordCount > 0 And Adoaff.Recordset.BOF = False Then
Adoaff.Recordset.MovePrevious
Call actualiser
Else
If Adoaff.Recordset.RecordCount > 0 And Adoaff.Recordset.BOF = True Then
MsgBox "Ceci est la première affectation effectuéé", vbOKOnly + vbExclamation, "ALERTE"
Adoaff.Recordset.MoveNext
Call actualiser
End If
End If
End Sub

Private Sub cmdpremier_Click()
If Adoaff.Recordset.RecordCount > 0 Then
Adoaff.Recordset.MoveFirst
Call actualiser
End If
End Sub

Private Sub cmdquit_Click()
Unload Me
End Sub

Private Sub cmdret_Click()
rep = InputBox("NUMERO DE L'AGENT A RETIRER:", "NUMERO")

Adoagaf.Refresh
Adoagaf.Recordset.MoveFirst

'chercher le numero de l'affectation dans agent_affectation

Adoagaf.Recordset.Find ("noaff= '" & txtnum.Text & "'")
Do While Adoagaf.Recordset.EOF = False

If Adoagaf.Recordset![Numero] = Val(rep) Then

noag = Adoagaf.Recordset![noagt]

Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt= '" & noag & "'")
Adoagt.Recordset![noaff] = ""
Adoagt.Recordset![noclient] = ""
Adoagt.Recordset.Update

'supprimer le nbre d'agent ds l'affectation concerné

nf = Adoagaf.Recordset![noaff]
Adoaff.Recordset.MoveFirst
Adoaff.Recordset.Find ("noaff= '" & nf & "'")
Adoaff.Recordset![nbre_agt] = Adoaff.Recordset![nbre_agt] - 1
Adoaff.Recordset.Update

Adoagaf.Recordset.Delete

If Adoagaf.Recordset.EOF = False Then
Adoagaf.Recordset.MoveNext
End If

Else
If Adoagaf.Recordset.EOF = False Then
Adoagaf.Recordset.MoveNext
End If
End If

Loop

Call actualiser

End Sub

'Code associé au bouton SAUVER
Private Sub cmdsauv_Click()

Call sauvegarde

Call actualiser
Call bloc
Call desactive
cmbaagt.Visible = False
End Sub

'Procédure permettant la sauvegarde des données de la grille
'************************************************************
'Le vrai problème se situe là!!!!!!!!!!!!!!!!!

Private Sub sauvegarde()
Dim noag
Dim cagt
Dim duree As Integer
Adolignaff.Recordset.MoveFirst
af = txtnum.Text
cli = txtcode.Text

Do While Adolignaff.Recordset.EOF = False

If Adolignaff.Recordset![noagt] <> "" Then
num = Adolignaff.Recordset![Numero]
cagt = Adolignaff.Recordset![noagt]
duree = Adolignaff.Recordset![duree_aff_agt]

'Enregistrement dans la table agent_affectation
nag = Adoagaf.Recordset.RecordCount

If nag > 0 Then
Adoagaf.Recordset.MoveFirst



Do While Adoagaf.Recordset.EOF = False

'chercher le numero de l'affectation dans agent_affectation

Adoagaf.Recordset.Find ("noaff= '" & af & "'")
noag = Adoagt.Recordset![noagt]
If Adoagaf.Recordset![Numero] = num Then 's'il existe

'trouver l 'agent qui n'en fait plus parti et le mettre à jour



Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt= '" & noag & "'")
Adoagt.Recordset![noaff] = ""
Adoagt.Recordset![noclient] = ""
Adoagt.Recordset.Update

'modifier l'agent dans agent_affectation

Adoagaf.Recordset![noaff] = af
Adoagaf.Recordset![Numero] = num
Adoagaf.Recordset![noagt] = cagt
Adoagaf.Recordset![duree_aff] = duree

Adoagaf.Recordset.Update

'mettre à jour le nouvel agent

Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt= '" & cagt & "'")
Adoagt.Recordset![noaff] = af
Adoagt.Recordset![noclient] = cli
Adoagt.Recordset.Update

Else

txt.Text = "OOOO"
If Adoagaf.Recordset![Numero] <> num And Adoagaf.Recordset.EOF = False Then

Adoagaf.Recordset.AddNew

Adoagaf.Recordset![noaff] = af
Adoagaf.Recordset![Numero] = num
Adoagaf.Recordset![noagt] = cagt
Adoagaf.Recordset![duree_aff] = duree

Adoagaf.Recordset.Save

Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt= '" & cagt & "'")
Adoagt.Recordset![noaff] = af
Adoagt.Recordset![noclient] = cli
Adoagt.Recordset.Update

End If

End If
nag = nag - 1
Adoagaf.Recordset.MoveNext
Loop

Else
Adoagaf.Recordset.AddNew

Adoagaf.Recordset![noaff] = af
Adoagaf.Recordset![Numero] = num
Adoagaf.Recordset![noagt] = cagt
Adoagaf.Recordset![duree_aff] = duree

Adoagaf.Recordset.Save

Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noagt= '" & cagt & "'")
Adoagt.Recordset![noaff] = af
Adoagt.Recordset![noclient] = cli
Adoagt.Recordset.Update

nag = nag - 1
End If

Adolignaff.Recordset.MoveNext

End If
Loop
Adoaff.Recordset.Save

End Sub



Private Sub cmdsuiv_Click()
If Adoaff.Recordset.RecordCount > 0 And Adoaff.Recordset.EOF = False Then
Adoaff.Recordset.MoveNext
Call actualiser
Else
If Adoaff.Recordset.RecordCount > 0 And Adoaff.Recordset.EOF = True Then
MsgBox "Ceci est la dernière affectation effectuéé", vbOKOnly + vbExclamation, "ALERTE"
Adoaff.Recordset.MovePrevious
Call actualiser
End If
End If

End Sub

Private Sub cmdsupp_Click()

If MsgBox("SUPPRESSION DE L'AFFECTATION EFFECTUEE POUR LE CLIENT" & cmbpren.Text, vbYesNo + vbQuestion, "SUPPRIMER") = vbYes Then
Adoagt.Recordset.MoveFirst
Do While Adoagt.Recordset.EOF = False
If Adoagt.Recordset![noaff] = txtnum.Text Then
Adoagt.Recordset![noaff] = ""
Adoagt.Recordset![noclient] = ""
Adoagt.Recordset.Update
Adoagt.Recordset.MoveNext
Else
Adoagt.Recordset.MoveNext
End If


Loop

Adoagaf.CommandType = adCmdTable
Adoagaf.RecordSource = "agent_aff"
Adoagaf.Refresh

Adoagaf.Recordset.MoveFirst
Do While Adoagaf.Recordset.EOF = False
If Adoagaf.Recordset![noaff] = txtnum.Text Then
Adoagaf.Recordset.Delete

Adoagaf.Recordset.MoveNext
Adoagaf.Recordset.MoveNext
End If
Adoagaf.Recordset.MoveNext
Loop


Adolignaff.CommandType = adCmdTable
Adolignaff.RecordSource = "ligne_affectation"
Adolignaff.Refresh
Adolignaff.Recordset.MoveFirst
Do While Adolignaff.Recordset.EOF = False


Adolignaff.Recordset.Delete

Adolignaff.Recordset.MoveNext
Loop
Adoaff.Recordset.Delete
Adoaff.Recordset.MoveFirst
End If
End Sub

Private Sub form_load()

Call actualiser
grilleaffect.AllowUpdate = False


End Sub
'Code pour éviter les doublons dans affectation
Private Sub verif()
nb = Adoaff.Recordset.RecordCount + 1
Adoaff.Recordset.MoveLast

If Adoaff.Recordset![noaff] = txtnum.Text Then
Call cle_cree
End If
End Sub
'Code recherchant le client concerné par une affectation
Private Sub affich()

num = txtnum.Text

If Adoagt.Recordset.RecordCount > 0 Then
Adoagt.Recordset.MoveFirst
Adoagt.Recordset.Find ("noaff= '" & num & "'")
If Adoagt.Recordset.EOF = False Then
client = Adoagt.Recordset![noclient]
End If
End If

If Adocltp.Recordset.RecordCount > 0 Then
Adocltp.Recordset.MoveFirst
Adocltp.Recordset.Find ("nocltp= '" & client & "'")
If Adocltp.Recordset.EOF = False Then
cmbpren = Adocltp.Recordset![nom_pren_cltp]
txtcode = Adocltp.Recordset![nocltp]
cmbrscm.Text = ""
End If
End If

If Adocltm.Recordset.RecordCount > 0 Then
Adocltm.Recordset.MoveFirst
Adocltm.Recordset.Find ("nocltm= '" & client & "'")
If Adocltm.Recordset.EOF = False Then
cmbrscm = Adocltm.Recordset![rscm]
txtcode = Adocltm.Recordset![nocltm]
cmbpren.Text = ""
End If
End If

End Sub
'Code d'actualisation
Private Sub actualiser()
Adolignaff.CommandType = adCmdText
Adolignaff.RecordSource = "select numero,agents.noagt,nom_pren_agt,duree_aff From agent_aff INNER JOIN agents ON agent_aff.noagt=agents.noagt WHERE agent_aff.noaff= '" & txtnum.Text & "'"

grilleaffect.AllowUpdate = False
Call affich
End Sub



Private Sub grilleaffect_AfterColEdit(ByVal ColIndex As Integer)

Select Case ColIndex

Case 3 'Contrôle de la durée de l'affectation

If grilleaffect.Columns(3).Value > 12 Then
MsgBox "LA DUREE NE DOIT PAS EXEDER 12 MOIS "
Else
If grilleaffect.Columns(3).Value <= 0 Then
MsgBox "LA DUREE NE DOIT PAS ETRE INFERIEURE A ZERO "
Else

Adolignaff.Recordset.Update

Adolignaff.Recordset.MoveNext
End If
End If
End Select
End Sub


Private Sub txtct_lostfocus()
Adoctr.Refresh
ct = Trim(txtct.Text)
Adoctr.Recordset.MoveFirst
Adoctr.Recordset.Find ("noctr='" & ct & "'")
If Adoctr.Recordset.EOF = False Then
txtdatectr.Text = Adoctr.Recordset![datecontrat]
Else
MsgBox "NUMERO DE CONTRAT MAL ORTHAGRAPHIE", vbOKOnly, "ATTENTION"
End If

End Sub
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017
27 déc. 2006 à 12:06
excuser moi lilo44, mais je sais pas si j'ai omis quelques choses ou si j'ai pas compris ce que vs m'aviez demandé
0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
27 déc. 2006 à 12:15
C'est cool, maintenant on a ton code, mais on ne sais toujours pas ce qui cloche...
0
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017
27 déc. 2006 à 12:45
A l'execution tout marche sauf que quuand je clique sur sauver on me dit que BOF ou EOF est egale à TRUE ou que l'enregistrement actuel a été supprimer et que l'opération demandée necessite un nouvel enregistrement. Dc l'affectation ne marche pas.
0
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017
27 déc. 2006 à 12:51
le problème commence à cette ligne dans la partie sauvergarde:

If Adoagaf.Recordset![Numero] = num Then 's'il existe
0
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
28 déc. 2006 à 08:39
Il semblerait que ton

Adoagaf.Recordset.Find ("noaff= '" & af & "'")

n'ai trouvé aucun résultat...

Renfield
Admin CodeS-SourceS- MVP Visual Basic
0
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017
28 déc. 2006 à 09:39
Justement c'est ca le problème à mon avis mais j'arrive pas à le corriger...
0
cs_djimson Messages postés 53 Date d'inscription samedi 14 octobre 2006 Statut Membre Dernière intervention 23 mai 2017
28 déc. 2006 à 10:47
Justement c'est ca le problème à mon avis mais j'arrive pas à le corriger...comment le corrigé?
0
Rejoignez-nous