Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2008

Tip: Looking for answers? Try searching our database.

rs.recordset not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MeSteve - 26 Mar 2008 21:36 GMT
I am trying to use rs.recordset to get the number of records in my table

Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase("my database path")
Set rs = db.OpenRecordset("tbl_Projects")

MsgBox rs.RecordCount

This returns 1 even though it will populate an array fully using do until
.EOF loop.  What am I missing?
Ken Warthen - 26 Mar 2008 21:47 GMT
MeSteve,

Try this:

Dim db as Database
Dim rs as Recordset
Dim intRecordCount as Integer

Set db=CurrentDb
set rs=db.openrecordset("MyTable")
With rs
 .MoveFirst
 .MoveLast
 intRecordCount = .RecordCount
End With
rs.close
set rs=nothing
MsgBox intRecordCount

Ken Warthen
kenwarthen@gmail.com

> I am trying to use rs.recordset to get the number of records in my table
>
[quoted text clipped - 7 lines]
> This returns 1 even though it will populate an array fully using do until
> .EOF loop.  What am I missing?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.