If I have two tables, OrdersAll and OrdersCurrent that both contain the field OrderID, and I want to select all the records in OrdersCurrent that have a different OrderID than ones in OrdersAll, is this the most efficient way to accomplish this task:
"SELECT * FROM OrdersCurrent AS OrdersNew
WHERE NOT EXISTS
(SELECT OrderID FROM OrdersCurrent WHERE OrdersCurrent.OrderID=OrdersAll.OrderID)"
I am used to PHP mySQL where you can check if anything is returned and then go row by row in a loop and do actions on the database. I understand loops in VBA, which is what I am using, but I can't seem to find a way to find out if anything is returned from a query, and then also, how to make a loop that deals with each record the results of a query have returned. Basically I would like to do something like this:
If data exists in OrdersNew
...while row exists in OrdersNew
...... do some UPDATES, INSERTS etc.
...endloop
Does anyone know if its possible to do stuff like this is VBA/MS Access environment?
Thanks
"SELECT * FROM OrdersCurrent AS OrdersNew
WHERE NOT EXISTS
(SELECT OrderID FROM OrdersCurrent WHERE OrdersCurrent.OrderID=OrdersAll.OrderID)"
I am used to PHP mySQL where you can check if anything is returned and then go row by row in a loop and do actions on the database. I understand loops in VBA, which is what I am using, but I can't seem to find a way to find out if anything is returned from a query, and then also, how to make a loop that deals with each record the results of a query have returned. Basically I would like to do something like this:
If data exists in OrdersNew
...while row exists in OrdersNew
...... do some UPDATES, INSERTS etc.
...endloop
Does anyone know if its possible to do stuff like this is VBA/MS Access environment?
Thanks