J
Jon Lewis
Hi All
I've a tblCompanies, tblCategories (many to many) and a junction table
tblCompaniesCategories. I need to open frmCompanies (bound to tblCompanies)
apply a filter and then delete all records from tblCompaniesCategories for a
specified Category and the Companies in the filtered recordset.
So some thing like this:
dbs.Execute "Delete FROM tblCompaniesCategories WHERE CategoryID = " &
Me.lstCategories & " AND CompanyID IN (SELECT CompanyID FROM
Forms!frmCompanies.RecordsetClone)", dbFailOnError
I get a syntax error in CompanyID IN (SELECT CompanyID FROM ....)
The filtered recordset is derifed from a complex multi-parameter filtering
process so it would be difficult to reproduce the SQL for this so can I use
a RecordsetClone in this way or are there any other suggestions (other than
looping through the RecordsetClone and checking for/deleting the Category
record in the junction table, which is slow)?
Many thanks
I've a tblCompanies, tblCategories (many to many) and a junction table
tblCompaniesCategories. I need to open frmCompanies (bound to tblCompanies)
apply a filter and then delete all records from tblCompaniesCategories for a
specified Category and the Companies in the filtered recordset.
So some thing like this:
dbs.Execute "Delete FROM tblCompaniesCategories WHERE CategoryID = " &
Me.lstCategories & " AND CompanyID IN (SELECT CompanyID FROM
Forms!frmCompanies.RecordsetClone)", dbFailOnError
I get a syntax error in CompanyID IN (SELECT CompanyID FROM ....)
The filtered recordset is derifed from a complex multi-parameter filtering
process so it would be difficult to reproduce the SQL for this so can I use
a RecordsetClone in this way or are there any other suggestions (other than
looping through the RecordsetClone and checking for/deleting the Category
record in the junction table, which is slow)?
Many thanks