John
I've got a pretty good idea of what you are doing, but I think you are going about it the wrong way.
Using ADO/DAO is the way I would do it, and it's the way I've done this sort of thing in the past.
Since you already have the SQL for your queries all you really need is the code to connect to the database(s).
That's actually quite straightforward, here's some sample code for connecting to an accdb databse.
Sub UpdateTbl()
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
Dim dbPath As String
dbPath = "C:\TestData\World.accdb"
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath
con.Open
Once you have the connection you can execute your UPDATE/DELETE queries.
strSQL= strSQL & " UPDATE " & Table
strSQL = strSQL & " SET " & Table & ".specificnumber = " & arrChangeTo(k)
strSQL = strSQL & " WHERE ((" & Table & ".specificnumber)=" & arrChangeFrom(k) & ")"
Set rst = New ADODB.RecordSet
rst.Open strSQL, con, adOpenDynamic, adLockOptimistic
While you have the connection open you can execute all the queries you want and once you are finished you close the recordset and connection.
rst.Close
Set rst = Nothign
con.Close
Set con = Nothing
Bookmarks