update query problem

G

Guest

I am trying to update fields in one table (Table 1) with a field(s) in
another table (Table 2). In the update to line I use the following for
Field1 and Field2 from Table1.

[tblTable2]![Field1] [tblTable2]![Field2]

The view of the query (before running) leaves Field2 from Table1 null even
though that field is not null in Table 2.

I do not understand what is going wrong.

Thanks,

LAF
 
J

John Vinson

I am trying to update fields in one table (Table 1) with a field(s) in
another table (Table 2). In the update to line I use the following for
Field1 and Field2 from Table1.

[tblTable2]![Field1] [tblTable2]![Field2]

The view of the query (before running) leaves Field2 from Table1 null even
though that field is not null in Table 2.

I do not understand what is going wrong.

Thanks,

LAF

Use . instead of !, and you *MUST* join the two tables:

UPDATE tblTable1
INNER JOIN tblTable2
ON tblTable1.Joinfield = tblTable2.Joinfield
SET [tblTable1].[Field1] = [tblTable2].[Field1],
[tblTable1].[Field2] = [tblTable2].[Field2]

You do need a join field which uniquely identifies which record is to
be updated.

John W. Vinson[MVP]
 

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

Similar Threads


Top