D
Deleted member 73419
Guest
Hi,
Can someone please tell me how to get an accurate RecordCount from an ADODB RecordSet?
I've tried using adOpenStatic CursorType and adLockOptimistic LockType. I've also tried moving from the first to the last record; all of these are suggestions from the web but they do not work.
I currently have this:
Can anyone help?
Many thanks
Can someone please tell me how to get an accurate RecordCount from an ADODB RecordSet?
I've tried using adOpenStatic CursorType and adLockOptimistic LockType. I've also tried moving from the first to the last record; all of these are suggestions from the web but they do not work.
I currently have this:
Code:
Sub b()
Dim conn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rst As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Open CurrentProject.Connection
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandText = "SELECT DocumentNumber, Revision, FROM PartImport WHERE ([DocumentNumber] = '" & strPartNumber & "');"
Set rst = cmd.Execute
rst.MoveLast
Debug.Print "Recordset recordcount: " & rst.RecordCount
rst.Close
conn.Close
Set rst = Nothing
Set conn = Nothing
End Sub
Can anyone help?
Many thanks