I use the following code from a an Excel Worksheet Macro(client Side) to connect and update the Spreedsheet and Database(also Client side)
Now I need to convert the connection to an ODBC connection to connect to an Access 2000 databse on the web(serverside)
from my client side Excel Spreedsheet wich is still gonna remain on the clent side....
Can anyone help me please ?
Now I need to convert the connection to an ODBC connection to connect to an Access 2000 databse on the web(serverside)
from my client side Excel Spreedsheet wich is still gonna remain on the clent side....
Can anyone help me please ?
Code:
Sub syncroc()
Dim max_row As Integer
Dim row As Integer
Dim col As Integer
Dim CON As ADODB.Connection
Dim sync() As String
Dim new_value As String
Set CON = New Connection
CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=E:\~QA\New Folder (12)\Wow.mdb"
max_row = Sheets("Mydata").UsedRange.Rows.Count
For row = 2 To max_row
ID = ActiveSheet.Cells(row, 1).Value
Name = ActiveSheet.Cells(row, 2).Value
Age = ActiveSheet.Cells(row, 3).Value
Salary = ActiveSheet.Cells(row, 4).Value
Dim rs As New Recordset
rs.Open "Select * from Master where ID=" & ID, CON, adOpenKeyset, adLockOptimistic
If rs.RecordCount <> 0 Then
rs![ID] = ID
rs![Name] = Name
rs![Age] = Age
rs![Salary] = Salary
rs.Update
rs.Close
Else
If rs.RecordCount = 0 Then
rs.AddNew
rs![ID] = ID
rs![Name] = Name
rs![Age] = Age
rs![Salary] = Salary
rs.Update
rs.Close
End If
End If
Next row
CON.Close
Set CON = Nothing
End Sub