S
steve lord
I have a table, tblHCM and a query, THistory. What I want to do is
simple:
DELETE DISTINCTROW tblHCM.*, THistory.Patient_ID
FROM tblHCM LEFT JOIN THistory ON tblHCM.Patient_ID = THistory.Patient_ID
WHERE THistory.Patient_ID Is Not Null;
This *should* delete all the records in tblHCM where the linking field is
also found in THistory.
Here's the catch: THistory is a query that exactly represents its
underlying table, TransactionHistory with one crucial detail: the
Patient_ID in TransactionHistory is a text(16). Patient_ID in tblHCM is
a LONG. Therefore, in THistory I recast the text as a long using the
CLNG function.
NOW, I get the oh-so-informative error 'Could not delete from specified
tables.'
IF, I first make a temporary table from TransactionHistory and cast the
text as a LONG in the make table query and use that temporary table in my
delete query then the delete query works fine.
SO, my question is: why doesn't my original delete query work when
linking on a LONG to a derived (i.e., cast) LONG?
Thanks for any help!!
simple:
DELETE DISTINCTROW tblHCM.*, THistory.Patient_ID
FROM tblHCM LEFT JOIN THistory ON tblHCM.Patient_ID = THistory.Patient_ID
WHERE THistory.Patient_ID Is Not Null;
This *should* delete all the records in tblHCM where the linking field is
also found in THistory.
Here's the catch: THistory is a query that exactly represents its
underlying table, TransactionHistory with one crucial detail: the
Patient_ID in TransactionHistory is a text(16). Patient_ID in tblHCM is
a LONG. Therefore, in THistory I recast the text as a long using the
CLNG function.
NOW, I get the oh-so-informative error 'Could not delete from specified
tables.'
IF, I first make a temporary table from TransactionHistory and cast the
text as a LONG in the make table query and use that temporary table in my
delete query then the delete query works fine.
SO, my question is: why doesn't my original delete query work when
linking on a LONG to a derived (i.e., cast) LONG?
Thanks for any help!!