How you named this file? That codes just count how many .mdb files and we don't know which file in position #4. Actualy the Dir Function will listed and arrange the file in ascending type and order by they name.
As i said before that we can't determine which file in position 4. But the files always be arranged in ascending order by they name.
Say the number of files is 4 and you want to delete the file in postion 4 (the last file). I try to put the files in listbox and accessing it by list index.
Private Sub Form_Load()
Dim strPath As String
Dim strFile As String
Dim FileCount As Integer
FileCount = 0
strPath = App.Path & "\backup\backup
strFile = Dir(strPath & "*.mdb")
Do Until strFile = ""
FileCount = FileCount + 1
List1.AddItem strPath & "\" & strFile
strFile = Dir
MsgBox FileCount & " file(s)"
Private Sub Command1_Click()
Kill List1.List(List1.ListCount - 1)