thkiller
Messages postés168Date d'inscriptionmercredi 24 mai 2006StatutMembreDernière intervention11 septembre 2007
-
7 juin 2006 à 08:27
thkiller
Messages postés168Date d'inscriptionmercredi 24 mai 2006StatutMembreDernière intervention11 septembre 2007
-
7 juin 2006 à 10:21
Bonjour,
J'aurais besoin de savoir quel propriété je doit utilisé pour tester si je suis à la fin ou au début de ma table.
J'ais bien essayer d'utilisé recordset.EOF et recordset.BOF mais c'est sans succé.
thkiller
Messages postés168Date d'inscriptionmercredi 24 mai 2006StatutMembreDernière intervention11 septembre 2007 7 juin 2006 à 10:21
Et bien voila je me suis débrouillé comm eun chef, je vous donne le code des deux bouttons pour ceux qui en aurais besoin :
Private Sub Command1_Click()
Do While rPrecedant.BOF = True
rPrecedant.MovePrevious
If rPrecedant.BOF = True Then
rPrecedant.MoveNext
Exit Do
End If
Loop
rPrecedant.MoveNext
If rPrecedant.EOF = True Then
MsgBox "Plus d'enregistrement précédant"
rPrecedant.MoveFirst
Command1.Visible = False
Command3.Visible = True
Exit Sub
End If
Text4.Text = rPrecedant.Fields!Date
Text5.Text = rPrecedant.Fields!NumOf
Text6.Text = Format((rPrecedant.Fields!Compteur), "# ##0")
Text7.Text = rPrecedant.Fields!Format
End Sub
et
Private Sub Command3_Click()
Do While rSuivant.BOF
rSuivant.MovePrevious
If rSuivant.BOF = True Then
rSuivant.MoveNext
Exit Do
End If
Loop
rSuivant.MoveNext
If rSuivant.EOF Then
MsgBox "Plus d'enregistrement suivant"
rSuivant.MoveFirst
Command3.Visible = False
Command1.Visible = True
Exit Sub
End If
Text4.Text = rSuivant.Fields!Date
Text5.Text = rSuivant.Fields!NumOf
Text6.Text = Format((rSuivant.Fields!Compteur), "# ##0")
Text7.Text = rSuivant.Fields!Format
End Sub
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013130 7 juin 2006 à 08:44
EOF correspond à "EndOfFile", c'est à dire que tu te trouve après le dernier enregistrement.
BOF correspond à "BeginOfFile", c'est à dire que tu te trouve avant le premier enregistrement.
Pour tester si tu es sur le premier ou le dernier, il faut d'abord de déplacer (soit en avant soit en arrière) puis tester l'EOF ou le BOF selon le cas, et revenir à la position d'origine.
thkiller
Messages postés168Date d'inscriptionmercredi 24 mai 2006StatutMembreDernière intervention11 septembre 2007 7 juin 2006 à 09:05
hum hum en effet je suis d'accord....
Le plus simple c'est que je te donne mon code enfin je pense !!
Private Sub Command1_Click()
If Not rSuivPre.BOF Then
rSuivPre.MoveLast 'Correctement effectuer
End If
If rSuivPre.BOF Then 'Condition que je ne trouve pas
MsgBox "Plus d'enregistrement précédant"
Command1.Visible = False
Command3.Visible = True
Exit Sub
Else
rSuivPre.MovePrevious
Text4.Text = rSuivPre.Fields!Date
Text5.Text = rSuivPre.Fields!NumOf
Text6.Text = Format((rSuivPre.Fields!Compteur), "# ##0")
Text7.Text = rSuivPre.Fields!Format
End If
thkiller
Messages postés168Date d'inscriptionmercredi 24 mai 2006StatutMembreDernière intervention11 septembre 2007 7 juin 2006 à 09:15
bon j'ais repensé tout ca et j'ais fait comme cela !!
Private Sub Form_Load()
Set rSuivant = bd.OpenRecordset("SELECT * FROM CompteurRebuts ORDER BY Date ASC", dbOpenDynaset)
Set rPrecedant = bd.OpenRecordset("SELECT * FROM CompteurRebuts ORDER BY Date DESC", dbOpenDynaset)
End Sub
Private Sub Command1_Click()
If Not rPrecedant.BOF Then
rPrecedant.MoveFirst
End If
If rPrecedant.EOF Then
MsgBox "Plus d'enregistrement précédant"
Command1.Visible = False
Command3.Visible = True
Exit Sub
Else
rPrecedant.MoveNext
Text4.Text = rPrecedant.Fields!Date
Text5.Text = rPrecedant.Fields!NumOf
Text6.Text = Format((rPrecedant.Fields!Compteur), "# ##0")
Text7.Text = rPrecedant.Fields!Format
End If
End Sub
mon déplacement est correct mais il n'arrive jamais à la fin de rPrecedant
idem pour rSuivant
Vous n’avez pas trouvé la réponse que vous recherchez ?
thkiller
Messages postés168Date d'inscriptionmercredi 24 mai 2006StatutMembreDernière intervention11 septembre 2007 7 juin 2006 à 10:01
Yééééééééé j'ais trouvé............
Private Sub Command1_Click()
Do While rPrecedant.BOF
rPrecedant.MovePrevious
If rPrecedant.BOF = True Then
rPrecedant.MoveNext
Exit Do
End If
Loop
rPrecedant.MoveNext
If rPrecedant.EOF Then
MsgBox "Plus d'enregistrement précédant"
Command1.Visible = False
Command3.Visible = True
Exit Sub
End If
Text4.Text = rPrecedant.Fields!Date
Text5.Text = rPrecedant.Fields!NumOf
Text6.Text = Format((rPrecedant.Fields!Compteur), "# ##0")
Text7.Text = rPrecedant.Fields!Format
End Sub
Et ca marche niquel merci encore pour ton aide et bonne journée.