Re: VB-Script Counts of Recordsets ADODB MS Access
- From: "Brian Kelly" <Brian@xxxxxxxxxxxxxx>
- Date: Fri, 20 Jan 2012 14:42:24 -0000
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
.
- Follow-Ups:
- Re: VB-Script Counts of Recordsets ADODB MS Access
- From: dieser hier
- Re: VB-Script Counts of Recordsets ADODB MS Access
- References:
- VB-Script Counts of Recordsets ADODB MS Access
- From: Uwe Wiards
- VB-Script Counts of Recordsets ADODB MS Access
- Prev by Date: VB-Script Counts of Recordsets ADODB MS Access
- Next by Date: Re: VB-Script Counts of Recordsets ADODB MS Access
- Previous by thread: VB-Script Counts of Recordsets ADODB MS Access
- Next by thread: Re: VB-Script Counts of Recordsets ADODB MS Access
- Index(es):
Relevant Pages
|