I have two Access DBs. One has all of the Customer Information (Sales DB)and resides on a machine without Access. The other contains a table with New Customer Information (NewInfo DB) which is emailed to the receipients frequently, in the same table format.
I would like a routine using SQL, to Update the information in the Sales DB,with information from the NewInfo DB.
I would also like a routine to Add New information into the Sales DB, with New records from the NewInfo DB.
I have the following so far:
VB Code:
Public Sub UpdateCustomerData() Dim SQL As String Dim CnnSales As ADODB.Connection Dim CnnNewInfo As ADODB.Connection Set CnnSales = New ADODB.Connection strConnectSales = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & App.Path & "\DB\Sales.mdb;" & _ "Persist Security Info=True;" Set CnnNewInfo = New ADODB.Connection strConnectNewInfo = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & App.Path & "\DB\NewInfo.mdb;" & _ "Persist Security Info=True;" CnnSales.Open strConnectSales CnnNewInfo.Open strConnectNewInfo SQL = "Insert into [tblCustomers] (Account,Name,Address) values ('1','2','3')" CnnSales.Execute SQL End Sub
I am just stuck on how to write the WHERE portion of the SQL, refering to the second DB and table.
I think I can get the second routine, if I could just get over this hump.
Help?




Reply With Quote