Recordcount problem
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
Fenerbahce
Junior Poster in Training
62 posts since Apr 2006
Reputation Points: 15
Solved Threads: 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
royaloba
Junior Poster in Training
54 posts since Sep 2006
Reputation Points: 13
Solved Threads: 1
try using rs.movelast
and then use rs.RecordCount
debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434