473,486 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Update Query with multiple tables

I need to to an update query that involves three tables: table Dealer
needs to be updated with data from table Personnel and table Title.

Dealer is joined to Personnel where Dealer.Dealer_Code =
Personnel.so_cd
Personnel is linked to Title by Personnel.name_id = Title.name_id

I need to update fields Principal_First_Name, Principal_Last_Name, and
Company_Email in Dealer from FirstName, LastName, and
InternetEmailAddr in Personnel where Title in PersonnelTitle = 'DM" or
"Dealer Principal".

I'm trying to do an update query in Access, and here is the SQL that
is generated:

UPDATE dbo_TABLE_Dealer INNER JOIN (Personnel INNER JOIN
PersonnelTitle ON Personnel.name_id = PersonnelTitle.name_id) ON
Dealer.Dealer_Code = Personnel.so_cd SET Dealer.Principal_Last_Name =
Personnel.LastName, Dealer.Principal_First_Name = Personnel.FirstName,
Dealer.Company_Email = Personnel.InternetEmailAddr
WHERE (((PersonnelTitle.Title) In ("DP","Dealer Principal")));

However, when I try to run it, I get a message that says "Operation
must use an updateable query". How do I need to change the query to
do what I need to do?

Thanks.

Steve

Apr 11 '07 #1
1 15716
Steve, the first thing to check out would be if there is a unique index on
the fields used in the join.

You joined Personnel.name_id to PersonnelTitle.name_id.
One of those tables will be the "one" side of the join.
Open that table in design view, and either mark the field as primary key, or
set the Indexed property to "Yes (No Duplicates)" (in the lower pane of
table design.)

Similarly, you joined Dealer.Dealer_Code to Personnel.so_cd.
Again, the field on the "one" side needs a unique index.

There's a list of things here:
Why is my query read-only?
at:
http://allenbrowne.com/ser-61.html
but the indexing is the most likely possibility.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<ra***********@hotmail.comwrote in message
news:11**********************@b75g2000hsg.googlegr oups.com...
>I need to to an update query that involves three tables: table Dealer
needs to be updated with data from table Personnel and table Title.

Dealer is joined to Personnel where Dealer.Dealer_Code =
Personnel.so_cd
Personnel is linked to Title by Personnel.name_id = Title.name_id

I need to update fields Principal_First_Name, Principal_Last_Name, and
Company_Email in Dealer from FirstName, LastName, and
InternetEmailAddr in Personnel where Title in PersonnelTitle = 'DM" or
"Dealer Principal".

I'm trying to do an update query in Access, and here is the SQL that
is generated:

UPDATE dbo_TABLE_Dealer INNER JOIN (Personnel INNER JOIN
PersonnelTitle ON Personnel.name_id = PersonnelTitle.name_id) ON
Dealer.Dealer_Code = Personnel.so_cd SET Dealer.Principal_Last_Name =
Personnel.LastName, Dealer.Principal_First_Name = Personnel.FirstName,
Dealer.Company_Email = Personnel.InternetEmailAddr
WHERE (((PersonnelTitle.Title) In ("DP","Dealer Principal")));

However, when I try to run it, I get a message that says "Operation
must use an updateable query". How do I need to change the query to
do what I need to do?

Thanks.

Steve
Apr 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3226
by: Ralph Guzman | last post by:
TASK: I have to generate a report with all categories, subcategories and products in database. PROBLEM: I want to write one query that will return: 1. category 2. subcategory: determined by...
8
3359
by: Rigga | last post by:
Hi, I am new to mysql and need help on how to join tables. I have a database which contains 4 tables, the main table contains information by date order and the other 3 contain data also in date...
3
70104
by: Falco Vermeer | last post by:
Hi, I tried to use the following query to update a value in one table with a value from another table: UPDATE tbl1 SET col1 = tbl2.col2 FROM tbl1, tbl2 WHERE tbl1. = tbl2.
8
10361
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
5
3051
by: mimo | last post by:
Hello, I have seen samples on how to pull data from one table and save back to it using the Form View control. How do I pull from multiple tables and save back to multiple tables on one...
0
7481
by: djflow | last post by:
Hi! II was wondering if you can help me with SQL query.. Below 7 separated select query works fine(only when they are retrieved separately) But I want to combined them together and so that i...
2
5479
by: Jasmine5 | last post by:
I have around 10 tables (let's call them tblNEEDUPDATE) and each has around 10-15 fields (first field is Name, rest have numbers). Also, I have a table let's call it tblUSEINUPDATE (this also has...
1
2179
by: lawardy | last post by:
Hi, I'm quite new with Reporting server 2005. I'm wondering if there is a way to write a select query that will get the data from 2 diffrent tables located in 2 diffrent database box. for...
4
2336
by: dstorms | last post by:
I'm trying to run an update query on multiple tables, and since Access doesn't allow me to update tables from a union query, I'm writing a module as a workaround. So I've set up a temporary recordest...
7
1308
by: KC-Mass | last post by:
I have two tables related to sales transactions and assigned areas. The tblSalesArea has SalesAreaID an autonumber StartZip, Text EndZip, Text The tblSales has many fields detailing all the...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.