How to Edit Record In Ms Access?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sebtus
    New Member
    • Sep 2010
    • 2

    #1

    How to Edit Record In Ms Access?

    I have the following code to edit an existing record.

    Code:
    If DCount("ID", "AssignLoc", "[ID] = '" & Me.ID & "'") > 0 Then
    Set db = CurrentDb
    Set rs = db.OpenRecordset("AssignLoc")
                            rs.Edit
                            rs("ID") = Me.ID
                            rs("AssignLoc") = Me.AssignLoc
                            'rs("OWC") = Me.OWC
                            rs("LastUpdate") = Format(Date, "dd-mmm-yy")
                            rs.Update
                            rs.Close
    When i try to run it, i get message saying that i cannot create duplicate entries. I want to edit not crate a new entry.. How can i fix it?
  • smartchap
    New Member
    • Dec 2007
    • 236

    #2
    With the part of the code it seems that you have not used
    rs.MoveNext
    command to move to next record. Put ur code in a loop and check from first record with
    rs.MoveFirst

    I hope it will help u.

    Comment

    Working...