DAO and Recordcount Max records

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I am a little new on Google Groups but decided to use it as I have
looked at it so many times.

From research, I have found out that a "Staff.MoveLast" must be placed
at 'X for it to give me the correct amount.

Dim db As DAO.Database
Dim NewStaff As DAO.Recordset
Set db = CurrentDb()
Set NewStaff = db.OpenRecordset("Staff") 'This is a query
'X
MsgBox NewStaff.RecordCount

NewStaff.Close

Should this code be based on a table, It would seem that Staff.MoveLast
is not needed. Is this correct?

As it is based on a query, is recordcount the current record or is it
the total? If it is the total, could I use Movelast then Move first
before running recordcount?

Is there a better way to count the number of records in a table?

Tom

.



Relevant Pages

  • Re: How to return a result of a SQL query within an Event Procedure (&what am I doing wrong her
    ... I ran the query manually and I get "five" hits for "Table ... But when I run the query programmically (see the below--it's the first ... always seem to get a RecordCount of 1. ... Dim db As DAO.Database ...
    (microsoft.public.access.formscoding)
  • MySQL database access help
    ... I am trying to get a recordcount to see if based on the query I entered, there is a username and password that matches the query. ... Dim myDataAdapter As MySqlDataAdapter ... Dim password As String ...
    (microsoft.public.vstudio.development)
  • Re: No recordcount from a procedure
    ... If you are checking the recordcount property in ADO, ... Dim cn As New ADODB.Connection ... Dim royalty As Variant ... adParamReturnValue) ...
    (microsoft.public.sqlserver.programming)
  • RE: Reading an external text file
    ... Changing the startRow and startColumn values won't make any difference. ... Dim startRow As Integer ... Dim recordCount As Integer ... populate an excel sheet for anaylsis. ...
    (microsoft.public.excel.programming)
  • Re: LDAP query returns data in parent domain but not from child do
    ... member attribute of one group, ... ' Comma delimited list of attribute values to retrieve. ... ' Construct the LDAP syntax query. ... Although the ADO object RecordCount ...
    (microsoft.public.windows.server.scripting)