RecordCount Property (ADO)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I use ADO Recordsets...I have a simple one. Its code looks like:

Dim fc As New ADODB.Connection
Dim SCADALocrst As New ADODB.Recordset

Set fc = CurrentProject.Connection
SCADALocrst.Open "select * from SCADALoc order by SCADANbr", fc,
adOpenDynamic

varReturn = SysCmd(acSysCmdInitMeter, SCADALocrst.RecordCount)
---------
The table "SCADALoc" is a simple 15-item list I repopulate from scratch
within the program. I use docmd.runsql to delete *, then insert all 15 or so
items. This is done in another routine, so the table is not open from that
routine, which has completed its work.

The call to syscmd() fails because SCADALocrst.RecordCount = -1. I've
changed the cursortype, the access method, everything on the "open"
statement, and still get the same -1 record count.

I need the record count and cursor position with the record count to update
the syscmd meter. Neither property seems to be giving me useful information.

As a programmer, I've never made a mistake, so I'm sure it must be a bug in
Access... but on the off chance, I thought I'd ask if anyone has an idea why
I'm not getting useful returns.... ;)
 
SCADALocrst.Open _
"select * from SCADALoc order by SCADANbr", _
fc, adOpenDynamic

varReturn = SysCmd(acSysCmdInitMeter, SCADALocrst.RecordCount)

countRecords = DCount("*", "SCADANbr")
varReturn = SysCmd(acSysCmdInitMeter, countRecords)


As a programmer, I've never made a mistake,

.... do you really mean that the way it sounds ..? <g>

HTH


Tim F
 
Thanks guys...

Yes, I was joking. I make more mistakes than I do non-mistakes.

Thanks again for the help....
 
Back
Top