I have tried some tricks however some thing seems to be wrong.. please help.
Expand|Select|Wrap|Line Numbers
- Sub update()
- Dim cn As Object
- Dim rs As Object
- Dim a As String
- strFile = "D:\temp excel\EIM.mdb"
- strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile & ";"
- Set cn = CreateObject("ADODB.Connection")
- Set rs = CreateObject("ADODB.Recordset")
- cn.Open strCon
- a = Sheet2.Range("D4")
- strSQL = "SELECT * FROM EIM WHERE EIM.NBKID=" & a
- rs.Open strSQL, cn
- strSQL = "UPDATE EIM SET EIM.Person#=('" & Sheet2.Range("D5") & "')WHERE EIM.NBKID=('" & Sheet2.Range("D4")
- cn.Execute strSQL
- End Sub
In the above code the file EIM has a table called EIM with NBKID and Person# fields.