Newbie here building a membership database. I have a simple single table containing membership info. The member ID is the primary key and auto numbers. I have a form to enter new members. I have another to search and update existing members. When entering a new member I want to ensure that it isn’t a duplicate in case the member exists already. It has been suggested to me that the way to do this is to set a unique index on the fields firstname plus lastname. When I search the web on how to do this the instruction is to right click a table and click on unique index. However this option does not come up for me when I right click on the table. Version 7.6.63 on Win 10. How do I set a unique index?
Enter thx SQL-command at Tools SQL:
CREATE UNIQUE INDEX index_name ON table_name (column1, column2,...);
Alternative to the CREATE INDEX command, you can open the table in design view (right-click>Edit…) and then call the index designer (Tools>Index design…).
Creation of a unique index fails if there are duplicates already.
There it is! That’s what I was looking for…I was right clicking and edit but then couldn’t find where the unique index was. Thank you! This worked.
For European style names, I would add the birthdate to the pair of names, which makes duplicate entries very unlikely.
Hi!
Mr. Villeroy showed you the way. But what about if you have e.g. two members bearing the same last name?
Remember that you could use combined PK on two fields (it’s menu driven) by using guided procedure.
Regards
Yes, I did use the first name and last name as the unique index and it seems to work just fine. I can enter a different first name and same last name is okay and if I enter same first name and same last name it prompts an error. Now if I knew how to make that error message be something simple rather than the long error message that would be even better. But I’ll work with it as it is. Also, there are no birthdates in this membership. Just contact info and membership details. A small membership of less than 200 records at this point. But a whole lot easier to maintain than nightmare spreadsheet that was used up until now.