VB How-ToAsk your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I want to update one table from another table in another database. U can say table A is in Database DBA and table B in Database DBB , I have to update records in table A from table B using UPDATE SQL command.
OK, Access has IN keyword so you can specify another database. For example, from Database which contains Table A use SQL like this:
INSERT INTO TableA
SELECT <<fields>> FROM TableB IN "<<path of other mdb file>>" WHERE ...
Thx Phil for the solution but I want to update the existing table A. The above INSERT command adds fresh records in tableA from table B. Is there any solution with update command please let me know.
You will need a subquery for this, something like:
UPDATE TableA
SET TableA.FieldName =
(SELECT OtherField FROM TableB IN "<<path of other mdb file>>" WHERE TableA.linkField = TableB.LinkField)