prevent duplicate entry

  • Thread starter Rasoul Khoshravan Azar
  • Start date
R

Rasoul Khoshravan Azar

I have a simple data base of English words, and the purpose is to enter the
hard words which I dont know the meaning. Over the time, some entries are
duplicating ( I have entered before, but unaware of their presense). I want
Access to notify me of this duplicates while I enter the new entry.
Is there any option or command to avoid duplicated entry for a field?

The only article I have found in Access Help titled: "Prevent duplicate
values from being entered in a combination of fields" but I think it doesn't
applicable to my question.
--
Very Sincerely Yours

Rasoul Khoshravan Azar
(e-mail address removed)
Azarbaijan Institute for Higher Education and Research (AIHER)
Water Engineering Dept. Lecturer
Tel: 098-411-288 67 46
Fax: 0098-411-289 50 23
 
S

ss01

I'm currently using this subroutine which works fine for me. Feel free to
modify it if it does not work for u.

'------------------------------------------------------------
' Job_No_BeforeUpdate
'
'------------------------------------------------------------
Private Sub Job_No_BeforeUpdate(Cancel As Integer)
On Error GoTo Job_No_BeforeUpdate_Err

If (Eval("DLookUp(""[Job_No]"",""[Tbl_Comprehensive_Maint]"",""[JobNo] =
Form.[Job_No] "") Is Not Null")) Then
' If the value of Job_No_BeforeUpdate is not unique, display a
message.
Beep
MsgBox "The Job No. you entered already exists. Enter a unique Job
No.", vbInformation, "Duplicate Job No."
' Return to the Job_No_BeforeUpdate control.
DoCmd.CancelEvent
End If


Job_No_BeforeUpdate_Exit:
Exit Sub

Job_No_BeforeUpdate_Err:
MsgBox Error$
Resume Job_No_BeforeUpdate_Exit

End Sub
==================================

Do a search in you help wizard on DLookup on how to use it.

Cheers!


silvre
 

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