Delete record and relationship records using kill

Bob, right again I had the wrong field and everything works great! Finally I can move foward.... Thanks a million and thanks for being patient.... :p

Code:
Private Sub cmdKillDelete_Click()

Dim rst As DAO.Recordset
Dim strTableName As String
Dim strSQL As String
Dim dbPath
    
dbPath = Application.CurrentProject.Path
 strSQL = "Select * From tblJobSteps Where [COLOR="Red"][B]VWIID[/B][/COLOR] = " & Me!VWIID
  Set rst = CurrentDb.OpenRecordset(strSQL)
    
Do Until rst.EOF
    If Dir(dbPath & rst!ImagePath) <> "" Then
       Kill (dbPath & rst!ImagePath)
    End If
    
    rst.MoveNext
Loop

rst.Close
Set rst = Nothing

End Sub

Thanks,
Chad
 

Users who are viewing this thread

Back
Top Bottom