How do I prevent entry of duplicate student names

A

Ann

I'm using Access 2003. I've created a database that has a form for entering
student registration information for a gymnastics class. I have a First Name
and Last Name field. The table also has a primary key of ID which has a data
type of AutoNumber. This table is linked to another table that keeps track of
each of the classes the student is taking (the linked field in the second
table is ID, which has a data type of Number). The person doing the data
entry wants a prompt that tells her if a student she is entering is already
in the database. Because the primary key is AutoNumber data type (which makes
each record unique, and therefore prevents identifying duplicate students),
I'm not sure how to respond to her request.
 
D

Douglas J. Steele

How can you identify a duplicate student name? What's to say you won't have
3 John Smiths in the same year?

One thing you could do in the form's BeforeInsert event is put logic to see
whether an entry with the same name exists, and ask the inputter whether
they want to continue processing the insert. You could use DLookup or DCount
to determine whether there are other entries, or you could open a recordset
and show them details of the other student(s) with the same name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top