creating a link between 2 tables and autopopulate fields (1 Viewer)

AljayB

Registered User.
Local time
Yesterday, 17:50
Joined
Dec 2, 2015
Messages
19
Hello there,

I would like to create a btn or something and use VBA code that can copy fields from table 1 to populate multiple fields in table 2 that use the same ID field. (see attachments).

For instance table 1 contains a "charge", which has a one to many relationship with table 2. so one charge can have many containers. Each container has to be analyzed in specific analytical procedures. each Charge also has to be analyzed aswell but in different procedures, however both container and charge have to have both analytical data done, because of the time and effort, this cant be done. therefore I would like a btn to copy the data from a full field in table 1 into the same name field that is empty in table 2. but only for data that are linked to the same ID field in tbl1.


If some1 has time to give me some advice or some advice how to write that or maybe a vba code that can do that would be awesome.

many thanks in advance!

I am a novice in VBA.
 

Attachments

  • table1.jpg
    table1.jpg
    29.1 KB · Views: 43
  • table2.jpg
    table2.jpg
    54.9 KB · Views: 42

RuralGuy

AWF VIP
Local time
Yesterday, 18:50
Joined
Jul 2, 2005
Messages
13,826
It is rarely a good idea to have the actual data in more than one table in an RDBM system. Primary Keys (PK) and Foreign Keys (FK) properly placed will always allow you to view the two tables as if they were one with a Join.
 

Users who are viewing this thread

Top Bottom