Thanks for your help in this regards, it is working fine.
I am having a AccountNo in Sheets("Sheet1").Range("A1") for "AccountID",
How can i define in this code to edit and update the record.
Kindly help me if it is possible.
(Ex.rs.FindFirst "AccountId = "????" )
Regards,
Ananth
I am not sure what this has to do with your original question, but see below:
-
Sub EDIT_UPATE()
-
Dim Path As String
-
Dim rs As DAO.Recordset
-
Dim AccountId As String
-
-
Path = "C:\Documents and Settings\Jaganmohan\Desktop\db1.mdb"
-
Set Db = Workspaces(0).OpenDatabase(Path, ReadOnly:=False)
-
Set rs = Db.OpenRecordset("Accounts", DbOpenDynaset)
-
-
-
If rs.RecordCount <> 0 Then
-
rs.FindFirst "AccountId = 2235" ' DAO only
-
If Not rs.NoMatch Then
-
rs.Edit ' DAO only
-
rs!Amount = 200
-
rs.Update
-
Else
-
MsgBox "Record Not Found"
-
End IfEnd If
-
rs.Close
-
Set Db = Nothing
-
Set rs = Nothing
-
-
EndSub