473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

RecordsetCount in Access ADO

I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq
Nov 12 '05 #1
7 8264
TC
I don't know about ADO, but in DAO, the recordcount property only returns
the number of records that have been >>accessed from that recordset so
far<<. This is >>not<< necessarily the total number of records in that
recordset. So you should always do a MoveLast on the recordset, before you
assume that recordcount will be the total # of records therein.

Perhaps if your records were being returned in batches of 2100, this would
explain what you see?

HTH,
TC
"Lauren Quantrell" <la*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq

Nov 12 '05 #2
la*************@hotmail.com (Lauren Quantrell) wrote in message news:<47**************************@posting.google. com>...
I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq

Weird. I thoughht if you specified that you wanted a static
recordset, you got a real recordcount, without doing a MoveLast, like
you have to do with DAO...
Nov 12 '05 #3
> I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?


You must use the "MoveLast" method to get an accurate recordcount for a
recordsetclone:

'********
Dim myRecords As Long, myString as string
'You must move to last record to get accurate recordcount
Me.RecordsetClone.MoveLast
'Retrieve the clone's recordcount
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."
'********

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #4
What happens is that Access lets the code run even though the form hasn't
loaded all of the rows yet. ADP's allow you to actually stop the loading
with a button on the scrollbar to interrupt the loading of data.

I think I did a requery just before the line you want the recordcount on.

Me.Requery
myRecs = Me.Recorsetclone.Recordcount
"Lauren Quantrell" <la*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq

Nov 12 '05 #5
la*************@hotmail.com (Lauren Quantrell) wrote in
news:47**************************@posting.google.c om:
I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq


In some versions of Access
Options->Advanced->Default Max Records
can be set.
If this is set to 100 then only 100 records would be downloaded for the
form and the form's recordsetclone would have only 100 records.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #6
TC

"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
la*************@hotmail.com (Lauren Quantrell) wrote in message

news:<47**************************@posting.google. com>...
I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq

Weird. I thoughht if you specified that you wanted a static
recordset, you got a real recordcount, without doing a MoveLast, like
you have to do with DAO...


NO! I just got burned by this recently. I needed to open a recordset based
on a query, then loop through the recordset, deleting certain records from
one of the tables on which the Query was based. I assumed that opening a
recordset with dbopensnapshot would take a snapshot of all of the relevant
records, thus removing any reliance on the query, or the underlying tables.

Wrong! You must still movelast to populate the whole snapshot. Opening the
recordset with dbopensnapshot *does not*, of itself, populate the whole
snapshot.

TC

Nov 12 '05 #7
This problem is not related to the MaxRecords. I think it's a cursor issue?
lq

Lyle Fairfield <Mi************@Invalid.Com> wrote in message news:<Xn*******************@130.133.1.4>...
la*************@hotmail.com (Lauren Quantrell) wrote in
news:47**************************@posting.google.c om:
I've been using this in my MDB projects:

Dim myRecords, myString as string
myRecs = me.recordsetclone.recordcount
myString = "There are " & myRecs & " records in this set."

It works fine in my MDBs, but in my ADO it works fine if there are 100
records or less, but always shows "100" for recordsets larger than
100.

Does anyone know how I can fix this?
lq


In some versions of Access
Options->Advanced->Default Max Records
can be set.
If this is set to 100 then only 100 records would be downloaded for the
form and the form's recordsetclone would have only 100 records.

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
13
by: bill | last post by:
I am trying to convince a client that dotNet is preferable to an Access project (ADP/ADE). This client currently has a large, pure Access MDB solution with 30+ users, which needs to be upgraded....
1
by: Dave | last post by:
Hello NG, Regarding access-declarations and member using-declarations as used to change the access level of an inherited base member... Two things need to be considered when determining an...
13
by: Simon Bailey | last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have a very simplified knowledge of databases overall. I would very much appreciate a (simplifed) message explaining the advantages...
0
by: Frederick Noronha \(FN\) | last post by:
---------- Forwarded message ---------- Solutions to Everyday User Interface and Programming Problems O'Reilly Releases "Access Cookbook, Second Edition" Sebastopol, CA--Neither reference book...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
64
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.