Update Data from one database in another one

Haakon

New member
Local time
Tomorrow, 00:10
Joined
Aug 2, 2013
Messages
7
Dear all,

As I stated already in another post:
I'm relatively new to MS Access (using MS Access 2013 but the db should work on 2010, too) and try to develop a database for an NGO I'm working in. [...].

However now I start to create forms and later reports for the actual user. The database will store information about clients and track consultations and assistance the NGO gives to them. There will be around 50.000 to 70.000 clients in the main table. Every client has a specific Individual ID and is member of a family which itself has another specific Group ID.
So now, I am almost done with forms (at least I want to believe that:D). But I ran into an issue I would love to have your comment and different approach on:

The Database I create is projected on another, significantly bigger database! The one I create is a kinda light version for other field offices with only the information they need to have, and additional tables for them to gather their own data and track their own activities. This being said, the light database needs to be updated every month once by the big (mother version). Both DBs cannot be connected!!!

So we will send to the field offices altogether 5 tables in one mdb-file every month. These 5 tables exist with the same structure ( name, field data-types, etc.) in the light version.

I now want to make an automatic update option (by pressing a key and select the "update-file"), i.e. based on the the respective Primary Key of every table the entry in the smaller DB should be updated!

Update for me means the following three things (Assume big DB is A, small DB is B):
1) If Primary Key (PK) exists in both tables of A and B, update the rest of the fields in B belonging to that key based on the specific record of A

2) If PK does not exist in A but in B, delete record from the database B (case: record was deleted in A after last update)

3) If PK does not exist in B but in A, add the record to database B (case: record was added to database A after last update)

I would like to show you what I already found in the internet on solving task 1) but I cannot post links due to my status :(
(One post from this form: "update one table using another" by kaiwalya1234;
And "Update Data by Using a Query" from the Access Help section of Microsoft)
Both links basically describe how to update one table by another in importing or linking the update-source table in the current DB, create a query with both tables, link the PKs of both and then using the Update To Criteria [UpdateSourceTable].[Field] for each field that I want to update.

But I wanted to ask before I implemented that if I should make a complete different approach since I also have 2) and 3) as tasks....

All insights, ideas, etc. are very very welcomed!!!! Just the actual way of updating the DB is not "discussable" :p

All the best,
Haakon
 
Last edited:
Hey Part Hartman,

thanks for your response first of all :)

No, the big database is the master-DB (A in my example) from which the updated data is retrieved. The light database (B) has these tables in common with A which cannot be altered within B. These tables and their fields can only be altered by database A..

However, in the light database there are a lot of other tables in relationship to these master-tables. these smaller tables contain information gathered which is not relevant for the big Master table but is used to track counselings, or other services. This data is used for the actual User to have a better understanding of the person he is looking up as well as creating monthly reports etc...

I hope it got a little bit clearer! So 5 tables of A are used to updated, delete, or add records to 5 tables in B...not the other way :)

Best,
Haakon
 
But don't I then have the problem, that I have lost data staying in the database, whenever I replace the full tables?
For example, we have two records in database B. After the replacement, however, we only have one of the two left. So the records in the other "counselling"-tables related to the now missing record have no connection anymore and stay as lost/unrelated data in the database...

I'm not sure if I could explain myself because I'm sick at the moment and my head is not working that well unfortunately :(

Is there not an option which goes like:
If record X from database A exists in B Then Update/Replace X and mark X as updated
If record X from database A does not exist in B then Add X and mark as added
Show all records in B which are not marked updated or added and delete these records
Unmark all records in B (so they are prepared for the next update)

Best,
Haakon
 

Users who are viewing this thread

Back
Top Bottom