Have you tried the update query I proposed? Maybe the message didn't made
it (it seems some messages have difficulties to appear), so I repost it
here:
You can do an insert/update in Jet by updating the unpreserved side of an
outer join. Example: tables Old and Mod:, Mod modifying unit price of
itemID:
UPDATE old RIGHT JOIN mod ON old.ItemID = mod.ItemID
SET old.itemID=mod.ItemID,
old.unitPrice = mod.unitPrice
which will update the unit price for existing itemID, and append new record,
in Old, for new itemId (that is why you need to set old.itemID=mod.ItemID
EVEN if the ON clause tell the same: since we have an outer join, old.itemID
place holder MAY be null, before the update, and, if the occurs, we want
this null to be replaced by mod.itemID).
Vanderghast, Access MVP
Andrew said:
sorry but I don't really understand you explainations.
1) From what I understand from your reply, can I do something this ?
e.g.
PARAMETERS KeyID Long, PatID IEEEDouble;
SELECT [Key ID], [Patient ID], IIF( [Key ID] <> null ,
"insert into KeyTable ( [Key ID], [Patient ID]) values (KeyID, PatID)",
"update KeyTable set [P ID] = PatID where [Key ID] = KeyID") AS Expr1
FROM KeyTable
WHERE [Key ID] = KeyID;
2) Do you know of any resource or webpage that I can lookup more about
querries?
--
Thanks in advance
regards,
Andrew
KARL DEWEY said:
1- Use IIF function. IIF(Test for True, Results for True, Results for
False) These may be nested.
2- Known as subquery. If you do not know subqueries then use first query
in
second joined with orignal table.
:
Hi all,
I'm new with access queries, I've mostly delt with stored procedures.
Is is possible to write a query that has an
if/else statement e.g.
if KeyID exist, then update ...
else if KeyID not exist, then insert. ....
also is it possible to call a query from within another query like a
nested
sp ?
--
Thanks in advance
regards,
Andrew