Form Field - No Duplicate

  • Thread starter Thread starter John Torres
  • Start date Start date
J

John Torres

Is there any way that a field in access form tells you immediately once a
record is duplicated? I went to Table and indexed it to "No Duplicates" but
it appears that a dialogue box appears after the whole entry form is filled
and then the warning sign.
Thanks,
John
 
Hi Al,
How do i do that? Is that a code that needs to be written? I tried typing
refresh and it was looking for macros.
Thanks again.
John
 
John,
In Form Design mode, select the field you want to monitor for dupes (ex.
MyField).
In the properties box for that field, find the AfterUpdate event.
Enter "Event Procedure" in the AfterUpdate text field. (no quotes)
(OR... Using the down arrow to the right of the textbox, select
[EventProcedure])
Click the little three dot button that appears on the right of the
AfterUpdate text box. (...)
You are now in the form's module, and you should see...

Private Sub MyField_AfterUpdate()

End Sub

Add your Refresh...

Private Sub MyField_AfterUpdate()
Refresh
End Sub

Now, each time MyField's value changes, if it violates the NoDuplicates
rule, it should bark that right away.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Back
Top