Solved

Updating Records in multiple tables

Posted on 2006-10-26
5
283 Views
Last Modified: 2012-06-27
I have a form which enters a customers address details in a table. It then asks if you would like to add the address into another table ( job address table).

The problem I have is, is that these records can then be edited (individually). How can I make it so that if one of the addresses (multiple fields) is edited, it will automatically uupdate the same record in the other table?

Thanks
0
Comment
Question by:vibale
5 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 17815668
create table relationship

set the referntial integrity
Cascade delete
cascade update
0
 

Author Comment

by:vibale
ID: 17815707
Yeah but the records arent exactly the same, one table has a couple of extra fields, will it still work?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 250 total points
ID: 18034771
vibale,

Another way to look at this is to re-think your system for "Adding" the address to another table.

The rules of database design dictate that data should only be stored once. (you key in the address once and it only gets stored in that one place)

You can use a query to "display" the address fields in another table (so the Address data will always be the same in both places).

Here is a simple example:
Table Name:  tblEmployees
Fields:
EmployeeID (PK)
FirstName
LastName
Address
City
Region
PostalCode

Your table with the "extra" fields: tblEmployeeExtra
Fields:
EmpExtraID (PK)
EmployeeID (FK)
BloodPressure
BloodSugar

Create a query to join these two tables on "EmployeeID": qryEmployeeExtra

SELECT tblEmployees.EmployeeID, tblEmployees.LastName, tblEmployees.FirstName, tblEmployees.Address, tblEmployees.City, tblEmployees.Region, tblEmployees.PostalCode, tblEmployeeExtra.BloodPressure, tblEmployeeExtra.BloodSugar
FROM tblEmployees LEFT JOIN tblEmployeeExtra ON tblEmployees.EmployeeID = tblEmployeeExtra.EmployeeID;

So if you change any address info in tblEmployees, it is reflected in this qryEmployeeExtra query.

When you need to update the "extra fields" simply create a main/subform (tblEmployees as the main and tblEmployeeExtra as the sub)

Hope this helps as well

Good luck

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now