Jeremy Campbell
asked on
Trying to setup a delete query in access based on results of another query.
Here is my Delete query as of right now.
I want to delete every row in the tblJobLog where tblJobLog.JobNum = qryJobLogDelCrit.jhJobNum.
Here is the sql for my current delete query;
DELETE tblJobLog.*
FROM tblJobLog INNER JOIN qryJobLogDelCrit ON tblJobLog.JobNum = qryJobLogDelCrit.jhJobNum
When I run this query as a Select query it will give me a list of JobNums that I would like to delete. I thought If I just changed it to a Delete query then it would delete those rows from tblJobLog.
When I try to run it I get the following error message;
Thanks for the help!
I want to delete every row in the tblJobLog where tblJobLog.JobNum = qryJobLogDelCrit.jhJobNum.
Here is the sql for my current delete query;
DELETE tblJobLog.*
FROM tblJobLog INNER JOIN qryJobLogDelCrit ON tblJobLog.JobNum = qryJobLogDelCrit.jhJobNum
When I run this query as a Select query it will give me a list of JobNums that I would like to delete. I thought If I just changed it to a Delete query then it would delete those rows from tblJobLog.
When I try to run it I get the following error message;
Thanks for the help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the SQL for qryJobLogDelCrit?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mbixup.. I'm sorry, I forgot to get all of my extra tables out of that query. qryJobLogDelCrit used to have a bunch of extra tables and calculations in it (I copied it from another table that had a bunch of stuff in it)
Once I deleted all the extra stuff from it, it ran almost immediately.
Thanks for the help there!
Thanks also Capricorn for your offering as well.. It would have solved the problem as well.
Once I deleted all the extra stuff from it, it ran almost immediately.
Thanks for the help there!
Thanks also Capricorn for your offering as well.. It would have solved the problem as well.
It sounds like you're set, but you probably could also work the criteria of qryJobLogDelCrit right into your delete query, to reduce it to a single query.
That would be my preferred approach if the second query was not overly complex, and was where I was heading asking about the SQL
That would be my preferred approach if the second query was not overly complex, and was where I was heading asking about the SQL
ASKER
Gotcha. Thanks again!
ASKER