Using a query as a record set to check if a path exists (1 Viewer)

brharrii

Registered User.
Local time
Today, 03:00
Joined
May 15, 2012
Messages
272
I have a module that I am using to verify that file paths in my table point to valid jpg files. The table has grown quite a bit since I first created the module and it has gotten to the point where it's taking too long for the module to execute. I'm in the process of trying to change the record set for the module from the table to a stored query procedure but it's turning out to be a little tricky for me. When I execute the following module, I'm not getting any error code, it just doesn't seem to do anything at all. The bits in red are the parts I've changed. Before that the module executed as I expected it would.

Any thoughts?

Thanks!

Code:
Sub TestIt2()
    Dim strFileName As String
[COLOR=red]    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb()
    Set rs = db.OpenRecordset("QryUpdateRevisionHistory")[/COLOR]
    
    'With CurrentDb.OpenRecordset("Select * From tblLabels")
[COLOR=red]    With rs[/COLOR]
        Do Until .EOF
            ' This not only turns error display off it also sets Err.Number to 0
            On Error Resume Next
            
            strFileName = Mid(!LabelImg, InStrRev(!LabelImg, "\") + 1)
            
            .Edit
            !LabelImage = Dir(Nz(!LabelImg, "\")) = strFileName And Err.Number = 0
            .Update
            
            .MoveNext
        Loop
    End With
    
End Sub
 

JHB

Have been here a while
Local time
Today, 12:00
Joined
Jun 17, 2012
Messages
7,732
Comment out the line with the "On Error Resume Next", then the error occur if there is any.
 

Users who are viewing this thread

Top Bottom