Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wdaw924 - 21 Nov 2005 20:35 GMT
The data on a table field I need to post on a different table when fields
from both tables match
Chris2 - 21 Nov 2005 23:38 GMT
> 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.
John Vinson - 21 Nov 2005 23:46 GMT
>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]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.