philippe pons
phpons at gmail.com
Wed Aug 22 12:40:11 CDT 2007
I say scan because I missed the verb you use to indicate you are "walking through" the collection of rows of a recordset. I do something like that (basic!): Me.lstListe.Recordset.MoveFirst ' if the recorset does'nt exist, get out! If Err.Number <> 0 Then Err.Clear Exit Sub End If Do While Not Me.lstListe.Recordset.EOF sngTotPourc = sngTotPourc + Left(Me.lstListe.Recordset.Fields(2), Len(Me.lstListe.Recordset.Fields(2)) - 1) / 100 curTotMontantsPre = curTotMontantsPre + Me.lstListe.Recordset.Fields (3) Me.lstListe.Recordset.MoveNext Loop I have to check the existence of the recordset, because sometimes, although the list is there on the form, it does not exist, giving then an error! 2007/8/22, philippe pons <phpons at gmail.com>: > > Hi all, > > I have a form with a list control. > The list displays quantities and amount. > Under the list, I have some text box that should display the total of > these quantities and amount. > > What I do is to use the recordset of the list, to scan each of the record > and do the sum I need. > > The problem is that this recordset does'nt seem to be reliable. > Sometimes it does'nt exist anymore, sometimes it has 250 rows instead of > just 5 to 10. > The calcultaion is ok only the first time i do it, and then it's not! > > Did you already get into these kinds of troubles? > What am I doing wroung? > > TIA, > Philippe >