Append Query using Unmatched Query as subquery to synchronize tables (1 Viewer)

Rx_

Nothing In Moderation
Local time
Yesterday, 23:22
Joined
Oct 22, 2009
Messages
2,803
In this situation, the Source table is on a server (vWells_ListX). A Read-Only view is made available for an Access application to linkto. The Primary Key (PK) is ID_Wells
The Access application needs to synchronize to the ID_Wells when the server adds a new record. So the Access Application has a table Wells_Setting.
The purpose of the Wells_Setting is to let users enter values. For example: The Field ShowInListBox - determines if the well will be visible in various listbox for the many forms.

As VWells_ListX adds new records, just the new records need to be appended (replicated) to the Wells_settings. A routine for the Main Form - Open Event can run to take care of this.

The goal was to create one single SQL Statement that would find what is missing between the two tables; and append the missing records to Wells_Settings.

See Attachment:
1 Without Matching Wells_Settings
Just used the Access Query Wizard "find unmatched query wizard" to find the unmatched records. Saved it as a query.
2. Query 2
Used the query above to create an Insert Into query to the destination Wells_Settings.
3. Query 3
Copied the first query and pasted it over the Query 2's Select ... From statement.

Great! The result of Query 3 is one query that appends any new records that are not in the destination.

It looks so simple, but this was very difficult to find anywhere.
 
Last edited by a moderator:

Users who are viewing this thread

Top Bottom