Originally Posted by
jscriptor09
So, the objective is compare each jpg file in item (1) list to item (2) list and if not found, write the item to a 3rd table.
What you're basically doing here is using recordset loops to do a task that something a single query can do by itself. So yeah, it's incredibly inefficient.
I didn't read all your code, but obviously you're extracting portions of the image names, so you'll need to use the same string extraction functions in the query statements too.
Basically the way you do this properly, is use an outer join in an append query to target the image names that are in table 1 but not table 2. Join on the equal field value and execute the query. That's the whole task, literally.
so if you want image names from table1 that's not in table2 and you want to append those names to table3, you write this:
Code:
INSERT INTO table3 (imagename)
SELECT table1.imagename
FROM table1 LEFT JOIN table2 on table1.imagename = table2.imagename
WHERE table2.imagename IS NULL
and the code you would write would probably be this:
Code:
Public Function findOldImages()
currentdb.execute(sql statement from above)
End Function
So yeah, a one-line function is probably what you're looking for!