Re: Total records in a query
From: Charles Tam (CharlesTam_at_discussions.microsoft.com)
Date: 12/03/04
- Next message: Jeffery: "Previously entered Data is not displayed in combo box"
- Previous message: Ashu: "loading of subforms & performance"
- In reply to: Marshall Barton: "Re: Total records in a query"
- Messages sorted by: [ date ] [ thread ]
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]
>
- Next message: Jeffery: "Previously entered Data is not displayed in combo box"
- Previous message: Ashu: "loading of subforms & performance"
- In reply to: Marshall Barton: "Re: Total records in a query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|