• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

How do prevent user data entry twice - prevent duplicate

I have student table with studenID field , last name field, first name field. And I have another table with studentID field, code field.
On the form, user enter studentID then i will show up that record, then user input data on code filed on the form.
My question that, if the user enter the same studentID then I would like to see a message box show up that this student already have data input (to prevent duplicate)
Please help. Thanks
0
qplo
Asked:
qplo
  • 4
1 Solution
 
qploAuthor Commented:
This is my code
Private Sub Form_AfterUpdate()

If Me.date > 0 Then
MsgBox "Already input"
End If
Cancel = True
End Sub

It show the message, but still add the record. Please help
0
 
qploAuthor Commented:
Correct code

Private Sub Form_AfterUpdate()

If Me.code > 0 Then
MsgBox "Date need update"
End If
Cancel = True
End Sub
0
 
qploAuthor Commented:
hello, anyone can help me please
0
 
qploAuthor Commented:
I would like to cancel this question
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now