fields in tbl 1+2 cols 1 match and I want data from tbl 2 col2 to.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The data on a table field I need to post on a different table when fields
from both tables match
 
The data on a table field I need to post on a different table when fields
from both tables match

Create a Query joining the two tables on the join fields. Change it to
an Update query; update the target table field to

=[sourcetable].[fieldname]

The brackets are essential; use your own table and field names of
course.

John W. Vinson[MVP]
 
wdaw924 said:
The data on a table field I need to post on a different table when fields
from both tables match

wdaw924,

The basic syntax of an UPDATE query is as follows.


UPDATE <table>
SET <column>
|,<column>...|
WHERE <criteria>


Example

CREATE TABLE OrderDetails
(OrderDetailID AUTOINCREMENT
,OrderID INTEGER
,OrderPlaced DATETIME
,ProductID INTEGER
,Quantity INTEGER
,CONSTRAINT pk_OrderDetails PRIMARY KEY (OrderDetailID)
)

Note: The FOREIGN KEY CONSTRAINTs for OrderID and ProductID have
been omitted for brevity.

Sample Data:

1, 5, 10/29/2005, 10, 1


Query:

UPDATE OrderDetails
SET Quantity = 20
WHERE OrderID = 5
AND ProductID = 10


Output:

1, 5, 10/29/2005, 10, 20


Sincerely,

Chris O.


PS My apologies if my answer didn't match your
question.

PPS Although meant for an sqlserver newsgroup, the
following link is still applicable for MS Access:
http://www.aspfaq.com/etiquette.asp?id=5006, and
is excellent when it comes to detailing how to
provide the information that will best enable
others to answer your questions.
 
Back
Top