Need some help with a query whose results are not updateable, that is I cannot enter
the correct value into the desired field ([ICD9 with Period]).
I believe it might be because the query involves another query and the base table
([History Edit]) does not have a primary key.
This is the base query:
SQL
SELECT ICD9.[ICD9 w/o period], ICD9.[ICD9 with Period], ICD9.[4th or 5th digit
required]
FROM ICD9 WHERE (((ICD9.[4th or 5th digit required])=False));
required]
FROM ICD9 WHERE (((ICD9.[4th or 5th digit required])=False));
The un-updatable query currently returns 5 rows and is:
SQL
SELECT DISTINCTROW HE.[ID#], HE.ICD9, qV.[ICD9 with Period],
HE.LAST_NAME, HE.DOS, HE.CPT4, HE.CITY, HE.STATE, HE.[INSURANCE
PLAN], HE.[DENIAL CODE]
FROM [History Edit] AS HE LEFT JOIN qryValid_ICD9 AS qV ON HE.ICD9 =
qV.[ICD9 with Period]
WHERE (((qV.[ICD9 with Period]) Is Null))
ORDER BY HE.[ID#];
HE.LAST_NAME, HE.DOS, HE.CPT4, HE.CITY, HE.STATE, HE.[INSURANCE
PLAN], HE.[DENIAL CODE]
FROM [History Edit] AS HE LEFT JOIN qryValid_ICD9 AS qV ON HE.ICD9 =
qV.[ICD9 with Period]
WHERE (((qV.[ICD9 with Period]) Is Null))
ORDER BY HE.[ID#];
When I revise the un-updatable query into a NOT IN query it takes longer and returns
no rows:
SQL
SELECT [History Edit].[ID#], [History Edit].ICD9, [History Edit].LAST_NAME,
[History Edit].DOS, [History Edit].CPT4, [History Edit].CITY, [History Edit].STATE,
[History Edit].[INSURANCE PLAN], [History Edit].[DENIAL CODE]
FROM [History Edit]
WHERE ((([History Edit].ICD9) Not In (select [ICD9 with Period] from ICD9 where [4th or 5th digit required]= false)))
ORDER BY [History Edit].[ID#];
[History Edit].DOS, [History Edit].CPT4, [History Edit].CITY, [History Edit].STATE,
[History Edit].[INSURANCE PLAN], [History Edit].[DENIAL CODE]
FROM [History Edit]
WHERE ((([History Edit].ICD9) Not In (select [ICD9 with Period] from ICD9 where [4th or 5th digit required]= false)))
ORDER BY [History Edit].[ID#];
However, if I revise it again into a NOT EXISTS, the revised query is fast and returns
the 5 rows but is still not updatable.
SQL
SELECT [History Edit].[ID#], [History Edit].ICD9, "" as [ICD9 with Period],[History Edit].LAST_NAME, [History Edit].DOS, [History Edit].CPT4, [History Edit].CITY, [History Edit].STATE, [History Edit].[INSURANCE PLAN], [History Edit].[DENIAL CODE]
FROM [History Edit]
WHERE NOT Exists (select [ICD9 with Period] from [ICD9] where ([icd9].[4th or 5th digit required]= false) AND [History Edit].[ICD9] = [icd9].[ICD9 with Period])
ORDER BY [History Edit].[ID#];
FROM [History Edit]
WHERE NOT Exists (select [ICD9 with Period] from [ICD9] where ([icd9].[4th or 5th digit required]= false) AND [History Edit].[ICD9] = [icd9].[ICD9 with Period])
ORDER BY [History Edit].[ID#];
The query would be used in a subform for data validation and I'd like the user to be
able to make corrections on the subform.
Thanks in advance,
Rey