Update table from another table.

  • Thread starter Thread starter Guest
  • Start date Start date
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,
 
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");
 
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");
 
Back
Top