Hi,
I am having troubles with the count of records in a Form. All my Tables used in my Access database are linked tables to an SqlServer. The Form I use is a wizzard created form and the recordsource is simple like "SELECT * FROM tab1 join tab2 ..".
I want to display the number of records in the form, but it seems, that the recordset does not load all records at once.
What i did is:
Private Sub Form_Current()
lblRecordCount.Caption = Recordset.RecordCount
End Sub
But when I open the form, it displays just "16", if i move to a record below, it changes to "28", when i scroll to the end it finally displays "100" - which is really the right count.
I tried this also with a new database, where i created a table with 500 records and then displayed the recordcount. This works fine.
Then i connected my "Persons" Table from the sql server, containing ~2500 records. Created a Form with the wizzard, displayed just 5 fields. When i open the form the recordcount is 101. Using "Page Down" a few times, the recordcount displayed changes 201, 301 .. and so on.
How can i force the Recordcount to load all data into the recordset, so that i can read the real count of records, when the query has finished

wrong count of Records in Access.Form
nialljsmith
K.V.Bharath
ok, that works, but I use the form as subform. In the main form I have a button. On the Click a create a new statement for the subform and send the stmt as source to the subform.
Which event in the subform do I have to use to recognize that the source has been modified and the records are different, including also rewrite the count of records
Epoch
Hi
Try using recordset.movelast before displaying the count, then use recordset.movefirst to return to the start. This may take a few moments though