[AccessD] Using the recordset of a list control

philippe pons phpons at gmail.com
Wed Aug 22 13:49:45 CDT 2007


Mark,

Yes, the rowsource is a sql (sql="select bla, bla..":
Me.lstListe.RowSource=sql), and on the form I have a combo box that will
update the list rowsource according the selection made.
Fields(1) and Field(2) are normally not Null.
Another fact: befor doing the calculation, I tried to requery the list, to
ensure th existence of a recordset, but it seems to be unefficient!

Thanks for your help.

2007/8/22, Mark A Matte <markamatte at hotmail.com>:
>
> Philippe,
>
> No problem on the verbage...I was just making sure I understood. In this
> sense...scan=loop.
>
>
> First question...what is the Rowsource on the listbox and does it change?
>
> Second Question...where you use .Fields(2) and .Fields(3)...can these ever
> be null?
>
> Thanks,
>
> Mark A. Matte
>
>
> >From: "philippe pons" <phpons at gmail.com>
> >Reply-To: Access Developers discussion and problem
> >solving<accessd at databaseadvisors.com>
> >To: accessd at databaseadvisors.com
> >Subject: Re: [AccessD] Using the recordset of a list control
> >Date: Wed, 22 Aug 2007 19:40:11 +0200
> >
> >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
> > >
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com
>
> _________________________________________________________________
> Puzzles, trivia teasers, word scrambles and more. Play for your chance to
> win! http://club.live.com/home.aspx?icid=CLUB_hotmailtextlink
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list