Hi All,
Having a few problems trying to count the number of records in a subform datasheet view and display that count in a text on the main form.
The problem is every solution i have tried is giving me the wrong number, i think this is because the subform has not completely loaded before my main form is grabbing the count?
I was wondering if anybody could help me find a solution.
I have a peice of code below, this code is in a button which will change all fields in a subform datasheet to certain value, could this be modified to instead of changing a value, count records?
Thanks in advance
Having a few problems trying to count the number of records in a subform datasheet view and display that count in a text on the main form.
The problem is every solution i have tried is giving me the wrong number, i think this is because the subform has not completely loaded before my main form is grabbing the count?
I was wondering if anybody could help me find a solution.
I have a peice of code below, this code is in a button which will change all fields in a subform datasheet to certain value, could this be modified to instead of changing a value, count records?
Thanks in advance
Code:
Dim rst As DAO.Recordset
Set rst = Me![StatusChangeSubform].Form.RecordsetClone
With rst
.MoveLast
.MoveFirst
Do While Not .EOF ' Hmmm.... This code will run until it hits the last record...
.Edit
!CaseStatus = "Pack Sent"
.Update
If Not .EOF Then 'Without this, won't it respond with a "No Current Record" error?
.MoveNext
End If
Loop
End With
Set rst = Nothing