Re: Total records in a query

From: Charles Tam (CharlesTam_at_discussions.microsoft.com)
Date: 12/03/04


Date: Fri, 3 Dec 2004 10:45:02 -0800

Thanks for your information.

"Marshall Barton" wrote:

> Charles Tam wrote:
>
> >I would like to retrieve the total records in a query. Is my following code
> >correct?
> >MS said to use the MoveLast command, but I have to install an error handle
> >if the recordset is empty.
> >...
> >Set qry = currentDatabase.OpenRecordset("Query1")
> >qry.MoveLast
> >debug.print qry.RecordCount
> >...
>
>
> You can check for an empty recordset by checking its
> RecordCount property. It won't actually tell you how many
> records there are, but it will only be zero when there are
> no records.
>
> Set qry = currentDatabase.OpenRecordset("Query1")
> If qry.RecordCount > 0 Then qry.MoveLast
> debug.print qry.RecordCount
>
> --
> Marsh
> MVP [MS Access]
>



Relevant Pages

  • Total records in a query
    ... I would like to retrieve the total records in a query. ... MS said to use the MoveLast command, but I have to install an error handle ...
    (microsoft.public.access.formscoding)
  • Re: conecting with a MsAcces DB by dao
    ... def append_from_Access: ... def Update(self, query, function): ... , for example, no problem, Access can retrieve a not empty recordset ... Access can retrieves a not empty recordset but my python code ...
    (comp.lang.python)
  • Re: Using field name for IN text string in query criteria
    ... the query to pull the NetworkID's instead? ... I tried this before and the compiler does not accept it. ... literal string delimiter is actually the apostrophe: ... It returns an empty recordset. ...
    (microsoft.public.access.formscoding)
  • Re: Parameters in INSERT query problem
    ... > parameters in the query... ... an implicit conversion is going on to make ... why are you creating a recordset from the Execute method of the Command ... You'll only get an empty recordset, ...
    (microsoft.public.data.ado)
  • Re: Query and recordsource
    ... Steve, Thanks for the info. ... This works OK but......When the query returns a empty recordset I get an ... hourglass for a few seconds and then it exits access. ... and a cmdbutton that sets the forms recordsource to the query. ...
    (microsoft.public.access.queries)