I need to count the number of records in a subform once a selection is made from a combobox. If there’s no record present, I would like to record it as a 0. I’ve added Text22 in the subform’s footer as =NZ([CountOfBATCH_ID],”0”). When I try to run the code, I receive a “Run-time error ‘2427’: You entered an expression that has no value."
I have on the change event of the combobox as
The code debugs on rst![DError] = Forms![Batch Detail]![qryRError subform1]![Text22]
I have on the change event of the combobox as
Code:
Dim db As DAO.Database
Set db = CurrentDb
Dim rst As DAO.Recordset
Set rst = db.OpenRecordset("tblSHS")
rst.AddNew
rst![BATCH_ID] = [BATCH_ID]
rst![DReview] = [Text70]
rst![DError] = Forms![Batch Detail]![qryRError subform1]![Text22]
rst!StatusTx = [cStatus].Text
rst!StatusDt = Now()
rst!StatusUpdateUser = xUserName
rst.Update
rst.Close
Set db = Nothing