I have a sorted record set (“NewTbl”) of the contents of a remote disk drive. This shows a great number of duplicated files and other anomalies. The record set holds the file name, its location on the disk and file type (extension). This allows me to assemble a string that should allow me to correctly identify any particular file. Using the Kill command I would be able to eliminate the duplicates. Generally speaking I’m OK with the logic of selecting the file I’m after but not so hot on the link to the disk using the available information. The code I’ve got together ( that doesn’t work is below). The line it fails on is “fl.Name = ThsHm & ThsFl & “.” & ThsExt” returning error 438 “Object doesn’t support this property or method”.
”’
Option Compare Database
Sub CleanUp()
Dim fl As Object
Set fl = CreateObject(“scripting.FileSystemObject”)
Dim fso As Object
Set fso = CreateObject(“scripting.FileSystemObject”)
Dim db As DAO.Database
Set db = CurrentDb
Dim NewTbl As DAO.Recordset
Set NewTbl = db.OpenRecordset(“Sorted”, dbOpenDynaset)
Dim ThsFl As String
Dim NxtFl As String
Dim ThsHm As String
Dim NxtHm As String
Dim ThsExt As String
Dim NxtExt As String
Dim ThsSz As String
Dim NxtSz As String
Dim FRED As Variant
NewTbl.MoveFirst
ThsFl = NewTbl("File").Value
ThsHm = NewTbl("Home").Value
ThsExt = NewTbl("Ext").Value
ThsSz = CStr(NewTbl("KB Size").Value)
NewTbl.MoveNext
NxtFl = NewTbl("File").Value
NxtHm = NewTbl("Home").Value
NxtExt = NewTbl("Ext").Value
NxtSz = CStr(NewTbl("KB Size").Value)
NewTbl.MovePrevious
If ThsHm = "F:" And NxtHm = "F:" Then
fl.Name = ThsHm & ThsFl & "." & ThsExt
Kill fl
End If
End Sub
”’