Update table from another table.

G

Guest

Hi,
I have two tables( Table_1 and Table_2) and Table_2 has a field that
calculate the max value from one field in Table_1.
I have the macro to calculate the max value, but I could not save this value
in Table_1.

Table_1
Field_1 Field_2 Field_3
X 10 20
y 11 21
z 12 22

The results of the query should update Table_2 as shown:
Table_2
Field_1 Field_2
12 22

Any help please,
 
K

Ken Snell [MVP]

Try this -- it gets the maximum value and then writes it into the
appropriate field:

UPDATE Table_2
SET Table_2.Field_1 = DMax("Field_2", "Table_1"),
Table_2.Field_2 = DMax("Field_3", "Table_1");
 
G

Guest

Thanks a lot Ken, it works.

Ken Snell said:
Try this -- it gets the maximum value and then writes it into the
appropriate field:

UPDATE Table_2
SET Table_2.Field_1 = DMax("Field_2", "Table_1"),
Table_2.Field_2 = DMax("Field_3", "Table_1");
 

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