Re: VB-Script Counts of Recordsets ADODB MS Access



On Fri, 20 Jan 2012 15:05:06 +0100, Uwe Wiards
<nospam@xxxxxxxxxxxxxxxx> wrote:

Hello,

i´m trying to read in VB-Script datas from a MS-Access database, but...
Into the table "Bestelldaten" are four test records, but .recordcount
told me "-1"

System: MS-XP and MS-Access 2002 SP3

Where are my mistakes?

SQL = "SELECT Bestelldaten.Nummer FROM Bestelldaten;"
strPfadDB = "c:\Testdb.mdb"
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" &
strPfadDB
Set Conn = CreateObject("ADODB.Connection")
Set Cmd = CreateObject("ADODB.Command")

conn.open strConn

cmd.ActiveConnection = conn

cmd.commandText=SQL

Set rs=CMD.Execute

If Not rs.EOF And Not rs.BOF Then
Msgbox "Count= " & rs.recordcount
Else

End If


Thanks an best regards

To amplify.

The value -1 means the RecordCount is not available at the moment you
asked.

This article gives a decent summary of the issues involved:
http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=33

hth
-ralph
.



Relevant Pages

  • Re: VB-Script Counts of Recordsets ADODB MS Access
    ... iŽm trying to read in VB-Script datas from a MS-Access database, ... Set Conn = CreateObject ... No mistakes as such but to get the record count you need to move to the last record ... The value -1 means the RecordCount is not available at the moment you asked. ...
    (microsoft.public.scripting.vbscript)
  • VB-Script Counts of Recordsets ADODB MS Access
    ... i´m trying to read in VB-Script datas from a MS-Access database, ... Into the table "Bestelldaten" are four test records, ... MS-XP and MS-Access 2002 SP3 ... Set Conn = CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: VB-Script Counts of Recordsets ADODB MS Access
    ... i´m trying to read in VB-Script datas from a MS-Access database, ... Into the table "Bestelldaten" are four test records, ... Set Conn = CreateObject ... No mistakes as such but to get the record count you need to move to the last ...
    (microsoft.public.scripting.vbscript)
  • RE: Help writing SQL in VBA
    ... The recordcount may not be getting set right away. ... Clifford Bass ... Dim conn As ADODB.Connection ... Set conn = CurrentProject.Connection ...
    (microsoft.public.access.modulesdaovba)
  • Incorrect RecordCount
    ... I'm trying to get the recordcount below if a user successfully logs in. ... Public Function ProcessEmployeeLogin ... Set Conn = Server.CreateObject ...
    (microsoft.public.inetserver.asp.db)