Use the MoveLast method to move the current record position to the last record in the Recordset. The Recordset object must support bookmarks or backward cursor movement; otherwise, the method call will generate an error.
A call to either MoveFirst or MoveLast when the Recordset is empty (both BOF and EOF are True) generates an error.
RecordCount Property Indicates the number of records in a Recordset object.
Return Value Returns a Long value that indicates the number of records in the Recordset.
Remarks Use the RecordCount property to find out how many records are in a Recordset object. The property returns -1 when ADO cannot determine the number of records or if the provider or cursor type does not support RecordCount. Reading the RecordCount property on a closed Recordset causes an error.
dimle>read my comment 12:36! It states that you will get -1 if ADO cannot determine the number of records or if the provider or cursor type does not support RecordCount! WHY DOES an Access dB NOT support this? WHY CAN YOU NOT USE SELECT COUNT (*) DO YOU HAVE A PRIMARY KEY
Det har jeg allerede besvaret - fordi jeg ville have VB til det! ...men... Jeg er ikke ret god til SQL Kan man ikke lave et kald hvor man får alle felter i en tabel sammen med den du foreslog: COUNT(*) As RECORDNUMBER sådan her, eller hvordan gør man??
SQL = "SELECT *, COUNT(*) As RECORDNUMBER FROM Bandene"
Den har primary-key og den udvælgen virker fint! Jeg ved ikke hvorfor Access ikke understøtter (.movelast .recordcount)!
Hvis du kan svare på spørgsmålet fra kl.: 14:17:23 med: SQL = "SELECT *, COUNT(*) As RECORDNUMBER FROM Bandene" ...så får du pointerne for dette spørgsmål!!!
Nej det ville ikke give bedre performance - Det er undersøgt! SELECT *, DCount("*", "Bandene") AS Antal FROM Bandene" er ca. 1/3 hurtigere end din metode!!!!!
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.