Question : Update field in table based on changes made to a field in second table

Hi There,

I have a table that has two fields called FirstName and Secondname, and a second table that has a single field called CompanyName. I want to be able to have a third table that has a record for each record in the rirst and second tables, holding either a combination of the firstname and lastname from the first table, or just the CompanyName from the Second table. For example,

Table 1 contains:
Firstname, Lastname, ID
John, Doe, 1
Jane, Doe, 2

Table 2 contains:
CompanyName, ID
Company1, 3
Company2, 4
Company3, 5

Table 3 would therfore contain:
NewField, ID
John Doe, 1
Jane Doe, 2
Company1, 3
Company2, 4
Company3, 5

If the data in table 1 or 2 is ever changed, then the changes would need to be reflected in table 3

Is this possible?

Thanks

Answer : Update field in table based on changes made to a field in second table

Go with hnasr - your 3rd "table" is just a query on the other two.  Since it is a query, every time you look at it, it correctly reflects any (previous) changes to the other 2 tables.

Just to make it clearer, I would let it have 3 columns, and this will also handle when the FirstName/Lastname is null (it retains the other without having the entire field go null)

Select iif(firstName is null, LastName, firstName & nz(" " & lastname, "") PersonOrCompany, ID, "Person" as Type
From Tbl1
Union ALL
Select CompanyName, ID, "Company"
From Tbl1
Random Solutions  
 
programming4us programming4us