Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why .RecordCount always return the number of all records?

Status
Not open for further replies.

reneford

Programmer
Dec 16, 2004
149
CA
Why ".RecordCount" always return the number of all records of the entire table? I just want to have the number of records return by the request. (The request can be a select, delete, ...)

Code:
With Form1.Adodc1
      .ConnectionString = "....mdb...Access..."
      .RecordSource = "" & Request & ""
      NUMOFRECORDS = .Recordset.RecordCount
      .Refresh
    End With
 
Try doing a Refresh before reading your Recordcount rather than after

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
This code worked for me.

Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Miner and Miner\ArcFM Solution\Sample Data\Geodatabases\ArcGIS9_Minerville.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "SELECT * FROM TRANSFORMER WHERE OBJECTID < 100"
Adodc2.Refresh
Dim rs As ADODB.Recordset
Set rs = Adodc2.Recordset
MsgBox "Number of records " + CStr(rs.RecordCount)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top