Compare and/or combine two Access database tables

  • Thread starter Thread starter Studiot
  • Start date Start date
  • Tags Tags
    Compare Database
AI Thread Summary
Two users have been working on separate copies of the same MS Access database, leading to discrepancies in their data. The issue arose when one user noticed that changes made were not visible to the other. To resolve this, suggestions include combining the two tables or comparing them to identify differences. One proposed solution involves writing a script to check for duplicates while appending unique entries from one table to the other. Another suggestion is to use an append query to add rows while ignoring duplicates. However, concerns were raised about handling records where only one field may have been updated, necessitating a method to retain the most recent version based on date. Overall, the discussion emphasizes the need for a systematic approach to merge and update the databases effectively.
Studiot
Messages
5,440
Reaction score
10
I have just discovered that two people have been typing into separate copies of 'the same' MS Access database for some while.

It came to light when one said, "Why can't Jo see the changes I make?"

Any suggestions on how to combine the two tables or at least compare them with a view to copy/pasting/appending the differences so that a great deal of work is not lost?

The two copies are of the same database so all the fields are the same.
 
Computer science news on Phys.org
If it was me, I'd write a script to open both tables, read a line from one and then iterate through the whole of the second table to check for a duplicate. If found, skip it. If not found, add to the end and generate a unique ID (or let Access do it if it's automatic).

I'm pretty sure you could even use the SQL to compare the two. But I'm not entirely sure on that.

Haven't used Access in a few years, but I can have a go at coding it roughly if you need it?
 
Hello Jared, welcome back, hope the exams or whatever went well.

Yes please coding/ programming is not my bag.
 
Actually, simpler would be for you to use an append query.

It will add the rows from one to the other and ignore duplicates. If it throws errors, ignore it.
 
OK thanks, however I'm not sure that append will work since only one field in a record may have been changed, so the record may appear in both copies, but one may have an updated field. I would need the latest version by date in that case.
 
You'll have to give me a day or so then so I can try and work through it.

It's actually really simple, I just haven't done it in ages.
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top