troubleshooting Question

SQL Delete Query in VBA in an MS Access database

Avatar of Bronwyn Coulthart
Bronwyn CoulthartFlag for Australia asked on
Microsoft Access
19 Comments1 Solution606 ViewsLast Modified:
I have studied the questions already listed for several hours now and I still keep receiving an error even after several redrafts of the code.  Forgive me I haven't written SQL embedded code in VBA at all so some of the more basic points I am missing.

I am trying to delete records from a permanent table (JobhMTItem) which match the records listed in a temporary table (TbxResequenceJohMTItem).  The code I have written is listed below, the "strSQL" string is on one line:

    Dim strSQL As String

   strSQL = "Delete JobhMtItem FROM JobhMtItem INNER JOIN TbxResequenceJohMTItem ON JobhMtItem.Id2 = TbxResequenceJohMTItem.Id2"

   CurrentDb.Execute strSQL, dbFailOnError


The above code fails with the following error:
"Error number 3128 - Specify the table containing the records you want to delete"

I have tried to match this to other answers provided by the experts to achieve similar results but I cannot see where I am going wrong.  Any help would be appreciated.

Thanks
Seybienne
ASKER CERTIFIED SOLUTION
peter57r

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros