I have a module used to backup the backend database. It does exactly that. I've added code to insert a record in to a table (BackupLog) that includes the path and file name of the backup. That works. I've also added code to determine if any of my backups have expired and if they have mark them for deletion. That works.
Now I'm trying to add code that will delete the expired backups. The code I have so far is below.
'Delete Expired Backups
Dim strRS As String
strRS = "Select * FROM BackupLog WHERE Delete = True"
Dim rs As Recordset
Dim BUFileDelete As String
Set rs = CurrentDb.OpenRecordset(strRS)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
BUFileDelete = rs![BackupFile]
Kill BUFileDelete
Loop
Else
MsgBox "No expired backups"
End If
Set rs = Nothing
When I run it I get a message 53: File not found. The expired files don't get deleted. Everything else works.
Any suggestions are appreciated.