Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I delete rows in a table from one database to the other in MS Access
    primarykey
    data
    text
    <p>I have two databases, a "Master" source (held locally) and a "Copy" database (to be distributed). Neither will be able to see each other once distributed (either locally or across a network), so we can't perform queries across the databases after distribution. I need to remove some content from the Copy database before it is distributed, so I decided to create a VBA script to produce the Copy databases for distribution.</p> <p>There are lookups in the tables, so I have decided to hold a template database (which was copied from the master source, and then stripped the tables out of them), then am dropping the tables and have recreated them in an appropriate order.</p> <p>I'm now needing to remove some of the data, and I'm struggling.</p> <pre><code>DeviceTable: AutoNumber(ID) Text(DeviceName) Integer(ClusterID) Text(Distribution) ClusterTable: AutoNumber(ID) Text(ClusterName) VirtualSystemTable: AutoNumber(ID) Text(VirtualSystemName) Integer(ClusterID) Integer(DeviceID) InterfaceTable: AutoNumber(ID) Integer(VirtualSystemID) Integer(ClusterID) Integer(DeviceID) Text(Description) </code></pre> <p>I need to remove entries from DeviceTable, ClusterTable, VirtualSystemTable and InterfaceTable for anything which is not marked as Distribution: "Public"</p> <p>Normally I would do (in psudocode):</p> <pre><code>arrDEV = SQL("SELECT ID, ClusterID FROM DeviceTable WHERE Distribution&lt;&gt;"Public"") </code></pre> <p>Then, for each response, I would</p> <pre><code>arrVSYS = SQL("SELECT ID FROM VirtualSystemTable WHERE DeviceID=$arrDEV.ID OR ClusterID=$arrDEV.ClusterID") SQL("DELETE FROM InterfaceTable WHERE DeviceID=$arrDEV.ID OR ClusterID=$arrDEV.ClusterID OR VirtualSystemID=$arrVSYS.ID") SQL("DELETE FROM VirtualSystemTable WHERE DeviceID=$arrDEV.ID OR ClusterID=$arrDEV.ClusterID") SQL("DELETE FROM ClusterTable WHERE ID=$arrDEV.ClusterID") </code></pre> <p>My issue is that I can't work out how to perform these queries across the database link. I amusing ADODB. I normally code in PHP, so this is a bit of a struggle for me!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload