Tigerlili3
Technical User
I have the following code to obtain the number of records in a table and use that in the table name when it is exported to another database. It works except the record count is low by 5 records every time, even if new records are added. If the count should be 5075, it shows up as 5070. If three records are added and it should be 5078, it shows up as 5073. Can anyone tell me why this is happening?
Thanks!
Thanks!
Code:
Function RecordCount()
Dim rstProblems As DAO.Recordset
Dim xCount As Variant
Set rstProblems = CurrentDb.OpenRecordset("tblLogs", dbOpenTable)
rstProblems.MoveLast
xCount = rstProblems.RecordCount
rstProblems.Close
DoCmd.TransferDatabase acExport, "Microsoft Access", _
"K:\Folder\MSAccess\Backup Versions\BackupTblLog.mdb", acTable, _
"tblLogs", "tblLogs" & Format(Now(), "mmddyy") _
& "_" & xCount, False
Set rstProblems = Nothing
Set xCount = Nothing
End Function