Re: VB-Script Counts of Recordsets ADODB MS Access



Uwe Wiards 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

No mistakes as such but to get the record count you need to move to the last
record
so instead of :-

Msgbox "Count= " & rs.recordcount

use :-

rs.movelast
Msgbox "Count= " & rs.recordcount


--
Brian Kelly
http://kellybk.com


.



Relevant Pages

  • 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, but .recordcount ... 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, ... 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)
  • Deleting files from ASP
    ... I am building an ASP web application to email a user with data from an ms-access database on request. ... The web-site is on a shared server running Win2k. ... after Set Conn = CreateObject ... Rec.Open sUrl, Conn, adModeReadWrite ...
    (microsoft.public.inetserver.iis)