#  Other Applications & Softwares  > Access Tables & Databases >  > [SOLVED] Connect 4 fields from 2 tables rather than updating both

## nigelog

Hi all, as is usual a situation has arisen that I need to update records on two tables within an access workbook. I could just update both tables by referencing them separately through vba but wonder is it easier to link the common fields within access so that when one table is updated the changes are reflected in second table. 

Database is currently functioning so I am hoping not to have to make radical changes at this point.

Basically it is table1 and table2 with 4 common fields named the same

Any pointers appreciated

I created the relationship between the 4 fields in the 2 tables and the relationship lines a re in the right place but I am guessing this is not the way to go as updates to one table are not reflected, how can I address the two records linked by ID2 and update the 4 fields in both with one Query through ADO from VBA

at the moment update finds ID2 on tblDelivered and updates 'Charge' and one of 'Cash' 'Card' or 'Cheque' but I am guessing the two records could be addressed at the same time

----------


## alansidman

A normalized Data Base does not have the same items in two tables.  Your data should be unique to only one table.  You can then create relationships between the tables using primary keys and foreign keys.  With your current design you will continue to have issues which will affect your outputs.  I have attached for your benefit a white paper on Relational Data Base Design.

----------


## nigelog

Thanks Alan I'll have a read. Unfortunately with this project starting to be used I'm too  late for radical design. As a first project I'm lucky to have got this far. I'll Have to go with an update query but get the following...

----------


## alansidman

I suspect that one field in one of the tables is numeric and the other one is text.

----------


## nigelog

@ Alan, Correct Alan, now just need to work out how to update only the record identified by ID2

@ all, I created a search query to select an individual ID2 number that does return the data to the database view when run (I used record 199 before I adapt for a variable) - and I created an update query that identifies the fields I want update but when I run both queries manually in order no record is updated

I hope to run these queries eventually from a userform sub but its the tables links are avaiding me....

Any help appreciated..workbook attached....AAAh, apparently cant upload access workbook

----------


## nigelog

I had it all backwards finally have update query working



```
Please Login or Register  to view this content.
```


need now to find out how to convert to include in a recordset sub

----------


## alansidman

BTW,
For the future, you can upload an Access File, but you need to Zip the file first.

Alan

----------

