Connecting Tech Pros Worldwide Help | Site Map

I can't get this query to work....

Newbie
 
Join Date: May 2007
Posts: 2
#1: May 7 '07
I'm running Access 2003 on XP and I am trying to do something that can't be done. I'm a total access plebe. The query I'm trying to run is:

UPDATE tblProvider
SET tblProvider.Inst_id=(SELECT tblCallLog.Inst_id
FROM tblCallLog
WHERE (((tblCallLog.Inst_id)="18") AND ((tblCallLog.prov_id)=(tblProvider.jsi_id))))
WHERE EXISTS
(SELECT tblCallLog.Inst_id
FROM tblCallLog
WHERE (((tblCallLog.Inst_id)="18") AND ((tblCallLog.prov_id)=(tblProvider.jsi_id))));

Basically, if the institution ID is 18 in the tblCallLog AND the tblCallLog.prov_id and tblProvider.jsi_id are equal, I want to change the tblProvider.Inst_id to 18.

Can this be done? I am having no luck here.
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#2: May 7 '07

re: I can't get this query to work....


I think you'll have to fall back on DLookup. I think subqueries would make this an unupdateable query.
Newbie
 
Join Date: May 2007
Posts: 2
#3: May 7 '07

re: I can't get this query to work....


Quote:

Originally Posted by Rabbit

I think you'll have to fall back on DLookup. I think subqueries would make this an unupdateable query.


I was afraid of that.... Let me say for the record I hate access.
Rabbit's Avatar
Expert
 
Join Date: Jan 2007
Location: California
Posts: 3,835
#4: May 7 '07

re: I can't get this query to work....


Looks like I spoke too soon.

I believe you can do this without a subquery. Try INNER JOINing the tables on the id field and set up the criteria appropriately.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#5: May 8 '07

re: I can't get this query to work....


Try this ...
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblProvider INNER JOIN tblCallLog 
  2. ON tblCallLog.prov_id=tblProvider.jsi_id
  3. SET tblProvider.Inst_id="18"
  4. WHERE tblCallLog.Inst_id="18"
Mary
Reply


Similar Microsoft Access / VBA bytes