Access update table

M

MiRoT

Hello.
Is there a way to auto-update a table in Access via one other table? I try
to do it with sql query and the query asks for values. I want to automaticaly
take the values when cretiria is true. Here is the code

UPDATE pelates SET poso_kefalaiou = (SELECT updatess.poso_kefalaiou FROM
updatess WHERE updatess.kwdikos_pelath = pelates.kwdikos_pelath)
WHERE EXISTS (SELECT updatess.poso_kefalaiou FROM updatess WHERE
updatess.kwdikos_pelath = pelates.kwdikos_pelath);

With this i want to auto-take the value poso_kefalaiou from table updatess
and place it to poso_kefalaiou in table pelates. Can this happen?
Thanks.
 
J

John Spencer

STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way you
expect.

I think you can do what you want with the following query.

UPDATE Pelates As P INNER JOIN UPDATESS as U
ON P.kwdikos_pelath = U.kwdikos_pelath
SET P.poso_kefalaiou = .[poso_kefalaiou]


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
M

MiRoT

Thanks A lot for your time John. That one is working perfect. Thanks again.

John Spencer said:
STEP 1: BACKUP your data before attempting the following.
STEP 2: BACKUP your data before attempting the following.

Without a backup you cannot restore the data if this does not work the way you
expect.

I think you can do what you want with the following query.

UPDATE Pelates As P INNER JOIN UPDATESS as U
ON P.kwdikos_pelath = U.kwdikos_pelath
SET P.poso_kefalaiou = .[poso_kefalaiou]


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Hello.
Is there a way to auto-update a table in Access via one other table? I try
to do it with sql query and the query asks for values. I want to automaticaly
take the values when cretiria is true. Here is the code

UPDATE pelates SET poso_kefalaiou = (SELECT updatess.poso_kefalaiou FROM
updatess WHERE updatess.kwdikos_pelath = pelates.kwdikos_pelath)
WHERE EXISTS (SELECT updatess.poso_kefalaiou FROM updatess WHERE
updatess.kwdikos_pelath = pelates.kwdikos_pelath);

With this i want to auto-take the value poso_kefalaiou from table updatess
and place it to poso_kefalaiou in table pelates. Can this happen?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top