G
Guest
Access 2000
I found this function on this site by one of the MVPs, which I typed into a
form module.
Public Function GetRecordCount()
Dim rst as DAO.recordset
Dim lngCount as Long
Set rst = CurrentDb.OpenRecordset("qryHowMany")
With rst.
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Debug.Print "Number of Records = " & lngCount
End Function
How do I call it? I opened the Immediate Window and typed ? GetRecordCount
and got the message "Sub or function not defined."
Then I added (still in the form module)
Private Sub Assigned()
Call GetRecordCount
End Sub
Same message. Obviously, I don't know what I'm doing!
Thanks,
Howard
I found this function on this site by one of the MVPs, which I typed into a
form module.
Public Function GetRecordCount()
Dim rst as DAO.recordset
Dim lngCount as Long
Set rst = CurrentDb.OpenRecordset("qryHowMany")
With rst.
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With
Debug.Print "Number of Records = " & lngCount
End Function
How do I call it? I opened the Immediate Window and typed ? GetRecordCount
and got the message "Sub or function not defined."
Then I added (still in the form module)
Private Sub Assigned()
Call GetRecordCount
End Sub
Same message. Obviously, I don't know what I'm doing!
Thanks,
Howard