In my form, in a button_Click event, I have the Insert Query command. How do I prevent from inputing a duplicate record Can anyone help If you need more clerfication, just reply.
The problem with FindByID() is that it works against a local copy of the data - there's no way to determine if the record exists in the data store or not. Someone could have added or removed the record from some other location or you may be working with a subset of data.
In Access, you will probably have to write a look-up method that checks for existence of a record before deciding what to do: update or insert.
You could do a DELETE FROM tablename WHERE (xxxxxx) before you do your INSERT to insure that an item is not already in there. You could do it all in one fails swoop with "DELETE.......; (<=== semicolon) INSERT........"
DataBase - Duplicate Records
Lampkin
oky
The problem with FindByID() is that it works against a local copy of the data - there's no way to determine if the record exists in the data store or not. Someone could have added or removed the record from some other location or you may be working with a subset of data.
In Access, you will probably have to write a look-up method that checks for existence of a record before deciding what to do: update or insert.
Ahmedabugh
jan_alex
You could do a DELETE FROM tablename WHERE (xxxxxx) before you do your INSERT to insure that an item is not already in there. You could do it all in one fails swoop with "DELETE.......; (<=== semicolon) INSERT........"
Trenton1
Tyler Whitney-MSFT
let say your table have the primary key call "ID"
then use the property "FindByID" to see if it is exist then do an update or insert depend on that.