Skip Bisconer
Who Me?
- Local time
- Yesterday, 22:02
- Joined
- Jan 22, 2008
- Messages
- 285
I would like to get two table record count results to two unbound textboxes on a form. My need is to compare record counts on two tables to make sure they are the same before proceeding with a month end process.
I have located a function through this site that is suppose to return a record count of a table however I don't seem to be able to get it to return anything but errors using the click event of a command button. Obviously I don't know how to use this function. Can some one show me the correct way to use this function in a sub routine?
Thanks for looking at my problem
I have located a function through this site that is suppose to return a record count of a table however I don't seem to be able to get it to return anything but errors using the click event of a command button. Obviously I don't know how to use this function. Can some one show me the correct way to use this function in a sub routine?
Thanks for looking at my problem
Code:
Public Function Table_RecordCount(sTable As String) As Long
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset(sTable)
If Not (rs.EOF) Then
rs.MoveLast
Table_RecordCount = rs.RecordCount
End If
Set rs = Nothing
End Function