0

Hi,
I use VB6 with Access. I have 4 records in my DBF file. When i do Recordcount, it says that i had -1 record. Why not 4? Help please
Thanks

Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim Query As String

Private Sub Form_Load()

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Projects\VB 6\Listbox\Database.mdb;Persist Security Info=False"
Conn.Open

Query = "SELECT * FROM Table1"
Set Rs = Conn.Execute(Query)

List1.AddItem Rs.RecordCount
End Sub

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by debasisdas
0

Hi,
I use VB6 with Access. I have 4 records in my DBF file. When i do Recordcount, it says that i had -1 record. Why not 4? Help please
Thanks

Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim Query As String

Private Sub Form_Load()

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Projects\VB 6\Listbox\Database.mdb;Persist Security Info=False"
Conn.Open

Query = "SELECT * FROM Table1"
Set Rs = Conn.Execute(Query)

List1.AddItem Rs.RecordCount
End Sub

try this
dim rs as new adodb.recordset

rs.CursorLocation = adUseClient
rs.open "Select * from table",conn
msgbox rs.recordcount
set rs=nothing

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.