i have a subform that is filtered by the key of the main form. i want to count how many items are in the subform
i tried this but it says i cannot use ".RecordCount = CountR" as read only
i tried this but it says i cannot use ".RecordCount = CountR" as read only
Code:
On Error GoTo ErrorH
Dim db As Database
Dim rs As Recordset
Dim PKey As String
Dim CountR As Integer
DoCmd.GoToRecord
PKey = Me.Product_Key
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM [ProductKeysAsigned] WHERE [Product Key] = PKey", dbOpenDynaset)
With rs
.MoveLast
.MoveFirst
.RecordCount = CountR
End With
rs.Close
Me.Keys_Used = CountR
GoTo EndH
ErrorH:
Call ErrorRPT1
EndH: