J
JamesJ
Hi. I'm using the following code on the OnCurrent of the form
to return the number of rows being returned in my continuous form:
In the General section of the module:
Dim frm As Form
------------------------------------------------------
Public Function RecCount()
Dim intCount As Integer
Set frm = Screen.ActiveForm
If frm.Recordset.RecordCount = 0 Then
frm!lblCount.Caption = "0 Item(s)"
Else
intCount = frm.Recordset.RecordCount
frm!lblCount.Caption = intCount & " Item(s)"
End If
End Function
The code works fine as a form function but not in a module.
I get the following Error:
Run-time error '2465':
MyDb can't find the field lblCount referred to in your expression.
The field is a label and is named lblCount.
Any help will be appreciated.
Thanks and Happy Thanksgiving!
James
to return the number of rows being returned in my continuous form:
In the General section of the module:
Dim frm As Form
------------------------------------------------------
Public Function RecCount()
Dim intCount As Integer
Set frm = Screen.ActiveForm
If frm.Recordset.RecordCount = 0 Then
frm!lblCount.Caption = "0 Item(s)"
Else
intCount = frm.Recordset.RecordCount
frm!lblCount.Caption = intCount & " Item(s)"
End If
End Function
The code works fine as a form function but not in a module.
I get the following Error:
Run-time error '2465':
MyDb can't find the field lblCount referred to in your expression.
The field is a label and is named lblCount.
Any help will be appreciated.
Thanks and Happy Thanksgiving!
James