Good day all,
Hoping for some help develop a vba sql statement within Access. This is what i'm trying to do:
I have a query which identifies records that are present in one table [TRACKER] and not in another [CF]: This is the sql statement from the design view:
SELECT DISTINCTROW Tracker.CF, Tracker.Lvl, Tracker.Loc, Tracker].SD, Tracker].eD, Tracker.Status, Tracker.TM, CF.CF, CF.Lvl, CF.Loc, CF.SD, CF.eD, CF.Status, CF.TM
FROM CFSR RIGHT JOIN Tracker ON CF.[CF] = Tracker.[CF]
WHERE (((CF.CF) Is Null) AND ((CF.Lvl) Is Null) AND ((CF.Loc) Is Null) AND ((CF.SD) Is Null) AND ((CF.eD) Is Null) AND ((CF.Status) Is Null) AND ((CF.TM) Is Null));
This query work perfectly fine. I would then like to take the records from the Tracker table that are displayed from the query and delete them. This is where i'm running into the problems.
I've come up with a simple delete statement, however it take a very long time to run:
sqlstr = "delete * " & _
" from Tracker" & _
" where not exists (select * from cf where Tracker.cf = cf.cf)"
'CurrentDb.Execute sqlstr
Is there a better way I could go about completing this task?
Thanks!
Hoping for some help develop a vba sql statement within Access. This is what i'm trying to do:
I have a query which identifies records that are present in one table [TRACKER] and not in another [CF]: This is the sql statement from the design view:
SELECT DISTINCTROW Tracker.CF, Tracker.Lvl, Tracker.Loc, Tracker].SD, Tracker].eD, Tracker.Status, Tracker.TM, CF.CF, CF.Lvl, CF.Loc, CF.SD, CF.eD, CF.Status, CF.TM
FROM CFSR RIGHT JOIN Tracker ON CF.[CF] = Tracker.[CF]
WHERE (((CF.CF) Is Null) AND ((CF.Lvl) Is Null) AND ((CF.Loc) Is Null) AND ((CF.SD) Is Null) AND ((CF.eD) Is Null) AND ((CF.Status) Is Null) AND ((CF.TM) Is Null));
This query work perfectly fine. I would then like to take the records from the Tracker table that are displayed from the query and delete them. This is where i'm running into the problems.
I've come up with a simple delete statement, however it take a very long time to run:
sqlstr = "delete * " & _
" from Tracker" & _
" where not exists (select * from cf where Tracker.cf = cf.cf)"
'CurrentDb.Execute sqlstr
Is there a better way I could go about completing this task?
Thanks!