0

I have created a database for students' attendance. I am facing an issue: if students scan their card twice there are two entries shown on the same day. I want one entry per day, and if someone tries twice then one entry should be deleted.

For this I have a table containing RFID numbers which are allocated to each student (this number is unique as well) and a auto current date & time when entry posted.

Now please suggest me how to stop the 2nd entry by coding as entry is done from a FORM which is directly connected with table.

1 Answer 1

1

You should have one table with student information and one table in which you store the combination of the date and the primary key (your RFID i presume). Then you should define a Primary key on the new table, that consist of the date + RFID. Since this is your primary key this has to be unique, and scanning a card twice won't allow it to be entered twice.

2
  • Dear Glenn i have done as per your statement given above. now system restrict me when doing the scanning twice. now what if i show the Error message on duplication ??? is this possible ??? Commented Jun 9, 2013 at 10:57
  • The primary key constraint ensures uniqueness of the combined fields that form the primary key. Because of that database prevents you from adding another record with the same RFID/date combination. You need to handle the error in your application. Commented Jun 10, 2013 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.