Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deleteing duplicate records..

    I have a subform that allows the users to tuype in an item ID#.. The problem I have is when the inadvertently add the same ID# twice. I have a button on the sub form that will delete the current record when pressed. But when the user enters in a duplicate ID# it will not delete the duplicate record and it gives me an error box saying the changes were not succesful because they would create duplicate values in the primary table.. If the user enters in a bogus value they then can delete the record.. Is there a better way than this? Thanks..

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Deleteing duplicate records..

    Put some code in to trap the duplicate key or index error and issue a Me.Undo to back out the new record when the error occurs. You aren't deleting the record because it has never been created--that's what the error means. Using an Undo method simply backs out whatever was entered in that record.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •